[PATCH 3/3] qemuTestParseCapabilitiesArch: Free @binary

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

 



The variable is allocated, but never freed.

==119642== 29 bytes in 1 blocks are definitely lost in loss record 409 of 671
==119642==    at 0x483579F: malloc (vg_replace_malloc.c:309)
==119642==    by 0x5AB075F: __vasprintf_internal (in /lib64/libc-2.29.so)
==119642==    by 0x57C1A28: g_vasprintf (in /usr/lib64/libglib-2.0.so.0.6000.7)
==119642==    by 0x579A0CC: g_strdup_vprintf (in /usr/lib64/libglib-2.0.so.0.6000.7)
==119642==    by 0x4AE6D58: vir_g_strdup_printf (glibcompat.c:197)
==119642==    by 0x136EEE: qemuTestParseCapabilitiesArch (testutilsqemu.c:291)
==119642==    by 0x138506: testQemuInfoSetArgs (testutilsqemu.c:763)
==119642==    by 0x135FFF: mymain (qemuxml2argvtest.c:3093)
==119642==    by 0x13A60E: virTestMain (testutils.c:839)
==119642==    by 0x1368C2: main (qemuxml2argvtest.c:3121)

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 tests/testutilsqemu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 0cb9a7456d..4dd5664f7b 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -288,8 +288,8 @@ qemuTestParseCapabilitiesArch(virArch arch,
                               const char *capsFile)
 {
     virQEMUCapsPtr qemuCaps = NULL;
-    char *binary = g_strdup_printf("/usr/bin/qemu-system-%s",
-                                   virArchToString(arch));
+    g_autofree char *binary = g_strdup_printf("/usr/bin/qemu-system-%s",
+                                              virArchToString(arch));
 
     if (!(qemuCaps = virQEMUCapsNewBinary(binary)) ||
         virQEMUCapsLoadCache(arch, qemuCaps, capsFile) < 0)
-- 
2.24.1





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux