[PATCH] qemu: Need to free fileprops in error path

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

 



The virJSONValueObjectCreate only consumes the object on success, so on
failure we must free - from commit id 'f4441017' (found by Coverity).

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 Coverity is also grumpy about the consumption of the object on the
 success path - probably because of the va_args manner in which the
 object gets consumed and later free'd.

 src/qemu/qemu_command.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 0094665..c4da8b5 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -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;
 }
-- 
2.5.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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]