|
|
fbe740 |
From 21199b5d14d4d21d2a1bdf9f17767d3c4b0bc00d Mon Sep 17 00:00:00 2001
|
|
|
fbe740 |
Message-Id: <21199b5d14d4d21d2a1bdf9f17767d3c4b0bc00d@dist-git>
|
|
|
fbe740 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
fbe740 |
Date: Wed, 19 Feb 2020 15:10:03 +0100
|
|
|
fbe740 |
Subject: [PATCH] qemuMonitorJSONBlockdevDel: Refactor cleanup
|
|
|
fbe740 |
MIME-Version: 1.0
|
|
|
fbe740 |
Content-Type: text/plain; charset=UTF-8
|
|
|
fbe740 |
Content-Transfer-Encoding: 8bit
|
|
|
fbe740 |
|
|
|
fbe740 |
Use automatic variable freeing and get rid of the cleanup section.
|
|
|
fbe740 |
|
|
|
fbe740 |
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
|
|
|
fbe740 |
(cherry picked from commit a592d589aa5015f5beb0f1d4302ceffe9fe7f7e8)
|
|
|
fbe740 |
|
|
|
fbe740 |
https://bugzilla.redhat.com/show_bug.cgi?id=1798366
|
|
|
fbe740 |
Message-Id: <e997465c781bb23dad07483313a29f4df2df9a1c.1582120424.git.pkrempa@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
fbe740 |
---
|
|
|
fbe740 |
src/qemu/qemu_monitor_json.c | 16 +++++-----------
|
|
|
fbe740 |
1 file changed, 5 insertions(+), 11 deletions(-)
|
|
|
fbe740 |
|
|
|
fbe740 |
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
|
|
|
fbe740 |
index ad490dd324..05a44882f0 100644
|
|
|
fbe740 |
--- a/src/qemu/qemu_monitor_json.c
|
|
|
fbe740 |
+++ b/src/qemu/qemu_monitor_json.c
|
|
|
fbe740 |
@@ -8833,9 +8833,8 @@ int
|
|
|
fbe740 |
qemuMonitorJSONBlockdevDel(qemuMonitorPtr mon,
|
|
|
fbe740 |
const char *nodename)
|
|
|
fbe740 |
{
|
|
|
fbe740 |
- virJSONValuePtr cmd;
|
|
|
fbe740 |
- virJSONValuePtr reply = NULL;
|
|
|
fbe740 |
- int ret = -1;
|
|
|
fbe740 |
+ g_autoptr(virJSONValue) cmd = NULL;
|
|
|
fbe740 |
+ g_autoptr(virJSONValue) reply = NULL;
|
|
|
fbe740 |
|
|
|
fbe740 |
if (!(cmd = qemuMonitorJSONMakeCommand("blockdev-del",
|
|
|
fbe740 |
"s:node-name", nodename,
|
|
|
fbe740 |
@@ -8843,17 +8842,12 @@ qemuMonitorJSONBlockdevDel(qemuMonitorPtr mon,
|
|
|
fbe740 |
return -1;
|
|
|
fbe740 |
|
|
|
fbe740 |
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
|
|
fbe740 |
- goto cleanup;
|
|
|
fbe740 |
+ return -1;
|
|
|
fbe740 |
|
|
|
fbe740 |
if (qemuMonitorJSONCheckError(cmd, reply) < 0)
|
|
|
fbe740 |
- goto cleanup;
|
|
|
fbe740 |
+ return -1;
|
|
|
fbe740 |
|
|
|
fbe740 |
- ret = 0;
|
|
|
fbe740 |
-
|
|
|
fbe740 |
- cleanup:
|
|
|
fbe740 |
- virJSONValueFree(cmd);
|
|
|
fbe740 |
- virJSONValueFree(reply);
|
|
|
fbe740 |
- return ret;
|
|
|
fbe740 |
+ return 0;
|
|
|
fbe740 |
}
|
|
|
fbe740 |
|
|
|
fbe740 |
|
|
|
fbe740 |
--
|
|
|
fbe740 |
2.25.0
|
|
|
fbe740 |
|