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(a)redhat.com>
---
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