render / rpms / libvirt

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