Commit 7fbf48446d for qemu.org
commit 7fbf48446de8d6c2b424cdd462ed680f0035f389
Author: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
Date: Thu Dec 28 11:12:12 2023 +0100
parallels: Set s->used_bmap to NULL in parallels_free_used_bitmap()
After used bitmap freeng s->used_bmap points to the freed memory. If we try
to free used bitmap one more time it leads to double free error.
Set s->used_bmap to NULL to exclude double free error.
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
Reviewed-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Denis V. Lunev <den@openvz.org>
diff --git a/block/parallels.c b/block/parallels.c
index 50748d1415..94692275c9 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -254,6 +254,7 @@ static void parallels_free_used_bitmap(BlockDriverState *bs)
BDRVParallelsState *s = bs->opaque;
s->used_bmap_size = 0;
g_free(s->used_bmap);
+ s->used_bmap = NULL;
}
static int64_t coroutine_fn GRAPH_RDLOCK