diff --git a/components/esp_partition/partition.c b/components/esp_partition/partition.c index 174d1c1f0d..3e9cbb1a70 100644 --- a/components/esp_partition/partition.c +++ b/components/esp_partition/partition.c @@ -237,7 +237,8 @@ void esp_partition_unload_all(void) partition_list_item_t *it; partition_list_item_t *tmp; SLIST_FOREACH_SAFE(it, &s_partition_list, next, tmp) { - SLIST_REMOVE(&s_partition_list, it, partition_list_item_, next); + // Remove current head from the list and free it, new head is the next element + SLIST_REMOVE_HEAD(&s_partition_list, next); free(it); } _lock_release(&s_partition_list_lock);