6ae9ed
From 7b98b60edd4358f427e13136e18e072c93602952 Mon Sep 17 00:00:00 2001
6ae9ed
Message-Id: <7b98b60edd4358f427e13136e18e072c93602952@dist-git>
6ae9ed
From: John Ferlan <jferlan@redhat.com>
6ae9ed
Date: Tue, 2 Aug 2016 13:42:05 +0200
6ae9ed
Subject: [PATCH] qemu: Need to free fileprops in error path
6ae9ed
6ae9ed
The virJSONValueObjectCreate only consumes the object on success, so on
6ae9ed
failure we must free - from commit id 'f4441017' (found by Coverity).
6ae9ed
6ae9ed
(cherry picked from commit 8ad7eceb20b2c08b09689b2c2ab755fc7d0acf16)
6ae9ed
6ae9ed
https://bugzilla.redhat.com/show_bug.cgi?id=1247521 [gluster multi-host]
6ae9ed
---
6ae9ed
 src/qemu/qemu_command.c | 4 +++-
6ae9ed
 1 file changed, 3 insertions(+), 1 deletion(-)
6ae9ed
6ae9ed
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
6ae9ed
index 88b5da1..0f9e2c4 100644
6ae9ed
--- a/src/qemu/qemu_command.c
6ae9ed
+++ b/src/qemu/qemu_command.c
6ae9ed
@@ -1038,8 +1038,10 @@ qemuGetDriveSourceProps(virStorageSourcePtr src,
6ae9ed
     }
6ae9ed
 
6ae9ed
     if (fileprops &&
6ae9ed
-        virJSONValueObjectCreate(props, "a:file", fileprops, NULL) < 0)
6ae9ed
+        virJSONValueObjectCreate(props, "a:file", fileprops, NULL) < 0) {
6ae9ed
+        virJSONValueFree(fileprops);
6ae9ed
         return -1;
6ae9ed
+    }
6ae9ed
 
6ae9ed
     return 0;
6ae9ed
 }
6ae9ed
-- 
6ae9ed
2.9.2
6ae9ed