From: Yi Li Date: Wed, 21 Oct 2020 09:23:40 +0000 (+0800) Subject: qemuMonitorJSONCheckReply: Use g_autofree X-Git-Tag: v6.9.0-rc1~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab6439b9602a7e295ba89c8c6bb598dd8a769d13;p=thirdparty%2Flibvirt.git qemuMonitorJSONCheckReply: Use g_autofree Eliminate cleanup code by using g_autofree. Signed-off-by: Yi Li Reviewed-by: Ján Tomko Signed-off-by: Ján Tomko --- 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; }