Coverity found that on error paths, the 'arg' value wasn't be cleaned
up. Followed the example in qemuAgentSetVCPUs() where upon successful call
to qemuAgentCommand() the 'cpus' is set to NULL; otherwise, when cleanup
occurs the free the memory for 'arg'
unsigned int nmountpoints)
{
int ret = -1;
- virJSONValuePtr cmd, arg;
+ virJSONValuePtr cmd, arg = NULL;
virJSONValuePtr reply = NULL;
if (mountpoints && nmountpoints) {
}
if (!cmd)
- return -1;
+ goto cleanup;
+ arg = NULL;
if (qemuAgentCommand(mon, cmd, &reply, true,
VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK) < 0)
}
cleanup:
+ virJSONValueFree(arg);
virJSONValueFree(cmd);
virJSONValueFree(reply);
return ret;