From 7b98b60edd4358f427e13136e18e072c93602952 Mon Sep 17 00:00:00 2001
Message-Id: <7b98b60edd4358f427e13136e18e072c93602952@dist-git>
From: John Ferlan <jferlan@redhat.com>
Date: Tue, 2 Aug 2016 13:42:05 +0200
Subject: [PATCH] qemu: Need to free fileprops in error path
The virJSONValueObjectCreate only consumes the object on success, so on
failure we must free - from commit id 'f4441017' (found by Coverity).
(cherry picked from commit 8ad7eceb20b2c08b09689b2c2ab755fc7d0acf16)
https://bugzilla.redhat.com/show_bug.cgi?id=1247521 [gluster multi-host]
---
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 88b5da1..0f9e2c4 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.9.2