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