1
0

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