From: Jiri Denemark Date: Fri, 19 Mar 2021 22:28:38 +0000 (+0100) Subject: qemu: Use g_autoptr in qemuMonitorJSONSetCapabilities X-Git-Tag: v7.2.0-rc1~50 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d5c9acc16644013d4e92f5678600dcb15f798b96;p=thirdparty%2Flibvirt.git qemu: Use g_autoptr in qemuMonitorJSONSetCapabilities Signed-off-by: Jiri Denemark Reviewed-by: Erik Skultety --- diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index b669630bc8..5e7f425495 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -1644,23 +1644,20 @@ qemuMonitorJSONHumanCommand(qemuMonitorPtr mon, int qemuMonitorJSONSetCapabilities(qemuMonitorPtr mon) { - int ret = -1; - virJSONValuePtr cmd = qemuMonitorJSONMakeCommand("qmp_capabilities", NULL); - virJSONValuePtr reply = NULL; - if (!cmd) + g_autoptr(virJSONValue) cmd = NULL; + g_autoptr(virJSONValue) reply = NULL; + + if (!(cmd = qemuMonitorJSONMakeCommand("qmp_capabilities", + NULL))) return -1; if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) - goto cleanup; + return -1; if (qemuMonitorJSONCheckError(cmd, reply) < 0) - goto cleanup; + return -1; - ret = 0; - cleanup: - virJSONValueFree(cmd); - virJSONValueFree(reply); - return ret; + return 0; }