Eliminate cleanup code by using g_autofree.
Signed-off-by: Yi Li <yili(a)winhong.com>
---
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 6c763ecc12..4994ace071 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -455,8 +455,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);
@@ -464,8 +464,6 @@ qemuMonitorJSONCheckReply(virJSONValuePtr cmd,
_("unexpected type returned by QEMU command
'%s'"),
qemuMonitorJSONCommandName(cmd));
- VIR_FREE(cmdstr);
- VIR_FREE(retstr);
return -1;
}
--
2.25.3