From 7581bc32cef9ad931183ce582454fffbd7401ca1 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Tue, 1 Jan 2013 00:42:01 -0600 Subject: [PATCH] rebuild_wim(): Fix use of freed memory update_lte_of_staging_file() can result in the freeing of the lookup table entry, so the staging list should be traversed with list_for_each_entry_safe() rather than list_for_each_entry(). --- src/mount_image.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mount_image.c b/src/mount_image.c index d2ce94b2..28a807d7 100644 --- a/src/mount_image.c +++ b/src/mount_image.c @@ -802,7 +802,7 @@ static int rebuild_wim(struct wimfs_context *ctx, int write_flags, } DEBUG("Calculating SHA1 checksums for all new staging files."); - list_for_each_entry(lte, &ctx->staging_list, staging_list) { + list_for_each_entry_safe(lte, tmp, &ctx->staging_list, staging_list) { ret = update_lte_of_staging_file(lte, w->lookup_table); if (ret != 0) return ret; -- 2.43.0