render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
a41c76
From bcbd86ca0e51a5f4fe41b128403d0a86c29150fa Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <bcbd86ca0e51a5f4fe41b128403d0a86c29150fa@dist-git>
a41c76
From: Peter Krempa <pkrempa@redhat.com>
a41c76
Date: Wed, 19 Feb 2020 15:10:02 +0100
a41c76
Subject: [PATCH] qemuMonitorJSONBlockdevAdd: Refactor cleanup
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
Use automatic variable freeing and get rid of the cleanup section.
a41c76
a41c76
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
a41c76
(cherry picked from commit 643294110c12a41faf2cf24c19948aaee0fcf36f)
a41c76
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1798366
a41c76
Message-Id: <ad40c6fde708c751fe9be90fd55e9b146cd26cd6.1582120424.git.pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 src/qemu/qemu_monitor_json.c | 16 +++++-----------
a41c76
 1 file changed, 5 insertions(+), 11 deletions(-)
a41c76
a41c76
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
a41c76
index 8cd98dbf26..ad490dd324 100644
a41c76
--- a/src/qemu/qemu_monitor_json.c
a41c76
+++ b/src/qemu/qemu_monitor_json.c
a41c76
@@ -8813,25 +8813,19 @@ int
a41c76
 qemuMonitorJSONBlockdevAdd(qemuMonitorPtr mon,
a41c76
                            virJSONValuePtr props)
a41c76
 {
a41c76
-    virJSONValuePtr cmd;
a41c76
-    virJSONValuePtr reply = NULL;
a41c76
-    int ret = -1;
a41c76
+    g_autoptr(virJSONValue) cmd = NULL;
a41c76
+    g_autoptr(virJSONValue) reply = NULL;
a41c76
 
a41c76
     if (!(cmd = qemuMonitorJSONMakeCommandInternal("blockdev-add", props)))
a41c76
         return -1;
a41c76
 
a41c76
     if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
a41c76
-        goto cleanup;
a41c76
+        return -1;
a41c76
 
a41c76
     if (qemuMonitorJSONCheckError(cmd, reply) < 0)
a41c76
-        goto cleanup;
a41c76
+        return -1;
a41c76
 
a41c76
-    ret = 0;
a41c76
-
a41c76
- cleanup:
a41c76
-    virJSONValueFree(cmd);
a41c76
-    virJSONValueFree(reply);
a41c76
-    return ret;
a41c76
+    return 0;
a41c76
 }
a41c76
 
a41c76
 
a41c76
-- 
a41c76
2.25.0
a41c76