]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Need to free fileprops in error path
authorJohn Ferlan <jferlan@redhat.com>
Thu, 28 Jul 2016 13:25:40 +0000 (09:25 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 28 Jul 2016 13:25:40 +0000 (09:25 -0400)
The virJSONValueObjectCreate only consumes the object on success, so on
failure we must free - from commit id 'f4441017' (found by Coverity).

src/qemu/qemu_command.c

index 0094665ca1416081944641fedb347cff50c4a473..c4da8b594acbaa75c7cf124c3a16c9f2e5116bb2 100644 (file)
@@ -1038,8 +1038,10 @@ qemuGetDriveSourceProps(virStorageSourcePtr src,
     }
 
     if (fileprops &&
-        virJSONValueObjectCreate(props, "a:file", fileprops, NULL) < 0)
+        virJSONValueObjectCreate(props, "a:file", fileprops, NULL) < 0) {
+        virJSONValueFree(fileprops);
         return -1;
+    }
 
     return 0;
 }