]> xenbits.xensource.com Git - libvirt.git/commitdiff
testQEMUSchemaValidateObjectMergeVariantMember: Fix theoretical leak
authorPeter Krempa <pkrempa@redhat.com>
Fri, 12 Feb 2021 10:36:30 +0000 (11:36 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Sat, 20 Feb 2021 12:26:37 +0000 (13:26 +0100)
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
tests/testutilsqemuschema.c

index 101687e657f92be34f52936eff24f06de834f7b8..4bb303a427528de3fc259050661661e67049c255 100644 (file)
@@ -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;
 }