From ab6439b9602a7e295ba89c8c6bb598dd8a769d13 Mon Sep 17 00:00:00 2001 From: Yi Li Date: Wed, 21 Oct 2020 17:23:40 +0800 Subject: [PATCH] qemuMonitorJSONCheckReply: Use g_autofree MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Eliminate cleanup code by using g_autofree. Signed-off-by: Yi Li Reviewed-by: Ján Tomko Signed-off-by: Ján Tomko --- src/qemu/qemu_monitor_json.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 445d794905..843a555952 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -457,8 +457,8 @@ qemuMonitorJSONCheckReply(virJSONValuePtr cmd, data = virJSONValueObjectGet(reply, "return"); if (virJSONValueGetType(data) != type) { - char *cmdstr = virJSONValueToString(cmd, false); - char *retstr = virJSONValueToString(data, false); + g_autofree char *cmdstr = virJSONValueToString(cmd, false); + g_autofree char *retstr = virJSONValueToString(data, false); VIR_DEBUG("Unexpected return type %d (expecting %d) for command %s: %s", virJSONValueGetType(data), type, cmdstr, retstr); @@ -466,8 +466,6 @@ qemuMonitorJSONCheckReply(virJSONValuePtr cmd, _("unexpected type returned by QEMU command '%s'"), qemuMonitorJSONCommandName(cmd)); - VIR_FREE(cmdstr); - VIR_FREE(retstr); return -1; } -- 2.47.2