qemuAgentShutdownMode mode)
{
int ret = -1;
- virJSONValue *cmd;
- virJSONValue *reply = NULL;
+ g_autoptr(virJSONValue) cmd = NULL;
+ g_autoptr(virJSONValue) reply = NULL;
cmd = qemuAgentMakeCommand("guest-shutdown",
"s:mode", qemuAgentShutdownModeTypeToString(mode),
ret = qemuAgentCommand(agent, cmd, &reply,
VIR_DOMAIN_QEMU_AGENT_COMMAND_SHUTDOWN);
- virJSONValueFree(cmd);
- virJSONValueFree(reply);
return ret;
}
unsigned int nmountpoints)
{
int ret = -1;
- virJSONValue *cmd;
- virJSONValue *arg = NULL;
- virJSONValue *reply = NULL;
+ g_autoptr(virJSONValue) cmd = NULL;
+ g_autoptr(virJSONValue) reply = NULL;
if (mountpoints && nmountpoints) {
- arg = qemuAgentMakeStringsArray(mountpoints, nmountpoints);
+ g_autoptr(virJSONValue) arg = qemuAgentMakeStringsArray(mountpoints, nmountpoints);
if (!arg)
return -1;
}
cleanup:
- virJSONValueFree(arg);
- virJSONValueFree(cmd);
- virJSONValueFree(reply);
return ret;
}
int qemuAgentFSThaw(qemuAgent *agent)
{
int ret = -1;
- virJSONValue *cmd;
- virJSONValue *reply = NULL;
-
- cmd = qemuAgentMakeCommand("guest-fsfreeze-thaw", NULL);
+ g_autoptr(virJSONValue) cmd = qemuAgentMakeCommand("guest-fsfreeze-thaw", NULL);
+ g_autoptr(virJSONValue) reply = NULL;
if (!cmd)
return -1;
}
cleanup:
- virJSONValueFree(cmd);
- virJSONValueFree(reply);
return ret;
}
unsigned int target)
{
int ret = -1;
- virJSONValue *cmd;
- virJSONValue *reply = NULL;
+ g_autoptr(virJSONValue) cmd = NULL;
+ g_autoptr(virJSONValue) reply = NULL;
cmd = qemuAgentMakeCommand(qemuAgentSuspendModeTypeToString(target),
NULL);
agent->await_event = QEMU_AGENT_EVENT_SUSPEND;
ret = qemuAgentCommand(agent, cmd, &reply, agent->timeout);
- virJSONValueFree(cmd);
- virJSONValueFree(reply);
return ret;
}
int timeout)
{
int ret = -1;
- virJSONValue *cmd = NULL;
- virJSONValue *reply = NULL;
+ g_autoptr(virJSONValue) cmd = NULL;
+ g_autoptr(virJSONValue) reply = NULL;
*result = NULL;
if (timeout < VIR_DOMAIN_QEMU_AGENT_COMMAND_MIN) {
cleanup:
- virJSONValueFree(cmd);
- virJSONValueFree(reply);
return ret;
}
unsigned long long minimum)
{
int ret = -1;
- virJSONValue *cmd;
- virJSONValue *reply = NULL;
+ g_autoptr(virJSONValue) cmd = NULL;
+ g_autoptr(virJSONValue) reply = NULL;
cmd = qemuAgentMakeCommand("guest-fstrim",
"U:minimum", minimum,
ret = qemuAgentCommand(agent, cmd, &reply, agent->timeout);
- virJSONValueFree(cmd);
- virJSONValueFree(reply);
return ret;
}
{
int ret = -1;
size_t i;
- virJSONValue *cmd;
- virJSONValue *reply = NULL;
+ g_autoptr(virJSONValue) cmd = NULL;
+ g_autoptr(virJSONValue) reply = NULL;
virJSONValue *data = NULL;
size_t ndata;
ret = ndata;
cleanup:
- virJSONValueFree(cmd);
- virJSONValueFree(reply);
return ret;
}
{
int ret = -1;
unsigned long long json_time;
- virJSONValue *cmd;
- virJSONValue *reply = NULL;
+ g_autoptr(virJSONValue) cmd = NULL;
+ g_autoptr(virJSONValue) reply = NULL;
cmd = qemuAgentMakeCommand("guest-get-time",
NULL);
ret = 0;
cleanup:
- virJSONValueFree(cmd);
- virJSONValueFree(reply);
return ret;
}
bool rtcSync)
{
int ret = -1;
- virJSONValue *cmd;
- virJSONValue *reply = NULL;
+ g_autoptr(virJSONValue) cmd = NULL;
+ g_autoptr(virJSONValue) reply = NULL;
if (rtcSync) {
cmd = qemuAgentMakeCommand("guest-set-time", NULL);
ret = 0;
cleanup:
- virJSONValueFree(cmd);
- virJSONValueFree(reply);
return ret;
}