aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>2017-07-14 15:33:41 +0300
committerMax Reitz <mreitz@redhat.com>2017-07-25 16:33:31 +0200
commitb6b75a99dab760c902c3d355519e0dc2616872e1 (patch)
tree6f29d6f7e2c3399d6e04e8fc925f731456804044 /block
parent0696ae2c9236a3589f5eaf5b00c12868b6f30a17 (diff)
qcow2-bitmap: fix bitmap_free
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 <vsementsov@virtuozzo.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 20170714123341.373857-1-vsementsov@virtuozzo.com Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/qcow2-bitmap.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c
index 3e8735a20d..e8d3bdbd6e 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);
}