Instead of only free()-ing the allocated data block, also clear the name
and size of a payload entry to indicate that it's become invalid.
Signed-off-by: Sander Vanheule <sander@svanheule.net>
}
/** Frees an image partition */
-static void free_image_partition(struct image_partition_entry entry) {
- free(entry.data);
+static void free_image_partition(struct image_partition_entry *entry)
+{
+ void *data = entry->data;
+
+ entry->name = NULL;
+ entry->size = 0;
+ entry->data = NULL;
+
+ free(data);
}
static time_t source_date_epoch = -1;
free(image);
for (i = 0; parts[i].name; i++)
- free_image_partition(parts[i]);
+ free_image_partition(&parts[i]);
}
/** Usage output */