qcow2-bitmap: initialize bitmap directory alignment
authorAndrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Mon, 27 May 2019 12:52:01 +0000 (15:52 +0300)
committerMax Reitz <mreitz@redhat.com>
Tue, 28 May 2019 18:30:55 +0000 (20:30 +0200)
Valgrind detects multiple issues in QEMU iotests when the memory is
used without being initialized. Valgrind may dump lots of unnecessary
reports what makes the memory issue analysis harder. Particularly,
that is true for the aligned bitmap directory and can be seen while
running the iotest #169. Padding the aligned space with zeros eases
the pain.

Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Message-id: 1558961521-131620-1-git-send-email-andrey.shinkevich@virtuozzo.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
block/qcow2-bitmap.c

index 640da68ce1a1860df04d6348141c428ab75fe612..b2487101edec0bdde613c561da897d25adfc74e9 100644 (file)
@@ -753,7 +753,7 @@ static int bitmap_list_store(BlockDriverState *bs, Qcow2BitmapList *bm_list,
         dir_offset = *offset;
     }
 
-    dir = g_try_malloc(dir_size);
+    dir = g_try_malloc0(dir_size);
     if (dir == NULL) {
         return -ENOMEM;
     }