[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 2/3] qcow2-bitmap: fix bitmap_free
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PULL 2/3] qcow2-bitmap: fix bitmap_free |
Date: |
Tue, 25 Jul 2017 17:12:32 +0200 |
From: Vladimir Sementsov-Ogievskiy <address@hidden>
Fix possible crash on error path in
qcow2_remove_persistent_dirty_bitmap. Although bitmap_free was added in
88ddffae8fc the bug was introduced later in commit 469c71edc72 (when
qcow2_remove_persistent_dirty_bitmap was added).
Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>
---
block/qcow2-bitmap.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c
index 3e8735a..e8d3bdb 100644
--- a/block/qcow2-bitmap.c
+++ b/block/qcow2-bitmap.c
@@ -487,6 +487,10 @@ static inline void bitmap_directory_to_be(uint8_t *dir,
size_t size)
static void bitmap_free(Qcow2Bitmap *bm)
{
+ if (bm == NULL) {
+ return;
+ }
+
g_free(bm->name);
g_free(bm);
}
--
2.9.4