[PATCH] qemublocktest: Don't leak 'disk' in testQemuImageCreateLoadDiskXML

Peter Krempa posted 1 patch 2 years, 6 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/8e3a7c6db990d0e43a765d3ba9e89b920a4e4364.1635171184.git.pkrempa@redhat.com
tests/qemublocktest.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] qemublocktest: Don't leak 'disk' in testQemuImageCreateLoadDiskXML
Posted by Peter Krempa 2 years, 6 months ago
The function returns only the source portion but forgot to free the disk
wrapper.

Fixes: 9696427ad67196
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
Pushed as a trivial CI fix.

 tests/qemublocktest.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
index 0176fbd3f4..9d3c2fe6b0 100644
--- a/tests/qemublocktest.c
+++ b/tests/qemublocktest.c
@@ -473,7 +473,7 @@ testQemuImageCreateLoadDiskXML(const char *name,
                                virDomainXMLOption *xmlopt)

 {
-    virDomainDiskDef *disk = NULL;
+    g_autoptr(virDomainDiskDef) disk = NULL;
     g_autofree char *xmlpath = NULL;
     g_autofree char *xmlstr = NULL;

@@ -490,7 +490,7 @@ testQemuImageCreateLoadDiskXML(const char *name,
     if (qemuDomainDeviceDiskDefPostParse(disk, 0) < 0)
         return NULL;

-    return disk->src;
+    return g_steal_pointer(&disk->src);
 }


-- 
2.31.1