mirror of https://gitee.com/openkylin/libvirt.git
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:
parent
7c24ee622c
commit
ab6439b960
|
@ -457,8 +457,8 @@ qemuMonitorJSONCheckReply(virJSONValuePtr cmd,
|
||||||
|
|
||||||
data = virJSONValueObjectGet(reply, "return");
|
data = virJSONValueObjectGet(reply, "return");
|
||||||
if (virJSONValueGetType(data) != type) {
|
if (virJSONValueGetType(data) != type) {
|
||||||
char *cmdstr = virJSONValueToString(cmd, false);
|
g_autofree char *cmdstr = virJSONValueToString(cmd, false);
|
||||||
char *retstr = virJSONValueToString(data, false);
|
g_autofree char *retstr = virJSONValueToString(data, false);
|
||||||
|
|
||||||
VIR_DEBUG("Unexpected return type %d (expecting %d) for command %s: %s",
|
VIR_DEBUG("Unexpected return type %d (expecting %d) for command %s: %s",
|
||||||
virJSONValueGetType(data), type, cmdstr, retstr);
|
virJSONValueGetType(data), type, cmdstr, retstr);
|
||||||
|
@ -466,8 +466,6 @@ qemuMonitorJSONCheckReply(virJSONValuePtr cmd,
|
||||||
_("unexpected type returned by QEMU command '%s'"),
|
_("unexpected type returned by QEMU command '%s'"),
|
||||||
qemuMonitorJSONCommandName(cmd));
|
qemuMonitorJSONCommandName(cmd));
|
||||||
|
|
||||||
VIR_FREE(cmdstr);
|
|
||||||
VIR_FREE(retstr);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue