[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PULL 09/19] qemu-img: free memory before re-assign

From: Max Reitz
Subject: [PULL 09/19] qemu-img: free memory before re-assign
Date: Wed, 11 Mar 2020 14:52:03 +0100

From: Pan Nengyuan <address@hidden>

collect_image_check() is called twice in img_check(), the filename/format will 
be alloced without free the original memory.
It is not a big deal since the process will exit anyway, but seems like a clean 
code and it will remove the warning spotted by asan.

Reported-by: Euler Robot <address@hidden>
Signed-off-by: Pan Nengyuan <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
 qemu-img.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/qemu-img.c b/qemu-img.c
index 4bc40df6d2..7b7087dd60 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -817,6 +817,8 @@ static int img_check(int argc, char **argv)
+        qapi_free_ImageCheck(check);
+        check = g_new0(ImageCheck, 1);
         ret = collect_image_check(bs, check, filename, fmt, 0);
         check->leaks_fixed          = leaks_fixed;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]