qemuMonitorJSONSetWatchdogAction: Use automatic memory clearing

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Peter Krempa 2021-08-20 14:09:14 +02:00
parent cc6241677b
commit ae6045ca84

View File

@ -8560,9 +8560,8 @@ int
qemuMonitorJSONSetWatchdogAction(qemuMonitor *mon,
const char *action)
{
virJSONValue *cmd;
virJSONValue *reply = NULL;
int ret = -1;
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
if (!(cmd = qemuMonitorJSONMakeCommand("watchdog-set-action",
"s:action", action,
@ -8570,17 +8569,12 @@ qemuMonitorJSONSetWatchdogAction(qemuMonitor *mon,
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;
}