|
|
fbe740 |
From bcbd86ca0e51a5f4fe41b128403d0a86c29150fa Mon Sep 17 00:00:00 2001
|
|
|
fbe740 |
Message-Id: <bcbd86ca0e51a5f4fe41b128403d0a86c29150fa@dist-git>
|
|
|
fbe740 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
fbe740 |
Date: Wed, 19 Feb 2020 15:10:02 +0100
|
|
|
fbe740 |
Subject: [PATCH] qemuMonitorJSONBlockdevAdd: 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 643294110c12a41faf2cf24c19948aaee0fcf36f)
|
|
|
fbe740 |
|
|
|
fbe740 |
https://bugzilla.redhat.com/show_bug.cgi?id=1798366
|
|
|
fbe740 |
Message-Id: <ad40c6fde708c751fe9be90fd55e9b146cd26cd6.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 8cd98dbf26..ad490dd324 100644
|
|
|
fbe740 |
--- a/src/qemu/qemu_monitor_json.c
|
|
|
fbe740 |
+++ b/src/qemu/qemu_monitor_json.c
|
|
|
fbe740 |
@@ -8813,25 +8813,19 @@ int
|
|
|
fbe740 |
qemuMonitorJSONBlockdevAdd(qemuMonitorPtr mon,
|
|
|
fbe740 |
virJSONValuePtr props)
|
|
|
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 = qemuMonitorJSONMakeCommandInternal("blockdev-add", props)))
|
|
|
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 |
|