From: Pavel Hrdina <[email protected]>

We would leak ret if the remaining two virJSONValueObjectAdd() calls
would fail but it will not happen with current code.

Fixes: c7570bbef89b20058095270e07fad0dcc8f60e7a
Signed-off-by: Pavel Hrdina <[email protected]>
---
 src/qemu/qemu_block.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 9b43279797..7986db8e76 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -433,7 +433,7 @@ static virJSONValue *
 qemuBlockStorageSourceGetNFSProps(virStorageSource *src)
 {
     g_autoptr(virJSONValue) server = NULL;
-    virJSONValue *ret = NULL;
+    g_autoptr(virJSONValue) ret = NULL;
 
     if (!(server = qemuBlockStorageSourceBuildJSONNFSServer(&src->hosts[0])))
         return NULL;
@@ -458,7 +458,7 @@ qemuBlockStorageSourceGetNFSProps(virStorageSource *src)
         virJSONValueObjectAdd(&ret, "i:group", src->nfs_gid, NULL) < 0)
         return NULL;
 
-    return ret;
+    return g_steal_pointer(&ret);
 }
 
 
-- 
2.53.0

Reply via email to