[PATCH 19/25] testQEMUSchemaValidateObjectMergeVariantMember: Fix theoretical leak

Peter Krempa pkrempa at redhat.com
Fri Feb 12 17:55:32 UTC 2021


Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 tests/testutilsqemuschema.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/testutilsqemuschema.c b/tests/testutilsqemuschema.c
index 101687e657..4bb303a427 100644
--- a/tests/testutilsqemuschema.c
+++ b/tests/testutilsqemuschema.c
@@ -163,13 +163,14 @@ testQEMUSchemaValidateObjectMergeVariantMember(size_t pos G_GNUC_UNUSED,
                                                void *opaque)
 {
     virJSONValuePtr array = opaque;
-    virJSONValuePtr copy;
+    g_autoptr(virJSONValue) copy = NULL;

     if (!(copy = virJSONValueCopy(item)))
         return -1;

     if (virJSONValueArrayAppend(array, copy) < 0)
         return -1;
+    copy = NULL;

     return 1;
 }
-- 
2.29.2




More information about the libvir-list mailing list