qemuMonitorJSONCheckReply: Use g_autofree

Eliminate cleanup code by using g_autofree.

Signed-off-by: Yi Li <yili@winhong.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Yi Li 2020-10-21 17:23:40 +08:00 committed by Ján Tomko
parent 7c24ee622c
commit ab6439b960

View File

@ -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;
}