mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: Avoid the memory allocation and freeing
This commit is contained in:
parent
8fb2164cff
commit
6fbd5737e9
@ -1759,23 +1759,19 @@ static char *
|
|||||||
qemuGetNumadAdvice(virDomainDefPtr def)
|
qemuGetNumadAdvice(virDomainDefPtr def)
|
||||||
{
|
{
|
||||||
virCommandPtr cmd = NULL;
|
virCommandPtr cmd = NULL;
|
||||||
char *args = NULL;
|
|
||||||
char *output = NULL;
|
char *output = NULL;
|
||||||
|
|
||||||
if (virAsprintf(&args, "%d:%llu", def->vcpus, def->mem.cur_balloon) < 0) {
|
cmd = virCommandNewArgList(NUMAD, "-w", NULL);
|
||||||
virReportOOMError();
|
virCommandAddArgFormat(cmd, "%d:%llu", def->vcpus,
|
||||||
goto out;
|
def->mem.cur_balloon);
|
||||||
}
|
|
||||||
cmd = virCommandNewArgList(NUMAD, "-w", args, NULL);
|
|
||||||
|
|
||||||
virCommandSetOutputBuffer(cmd, &output);
|
virCommandSetOutputBuffer(cmd, &output);
|
||||||
|
|
||||||
if (virCommandRun(cmd, NULL) < 0)
|
if (virCommandRun(cmd, NULL) < 0)
|
||||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Failed to query numad for the advisory nodeset"));
|
_("Failed to query numad for the "
|
||||||
|
"advisory nodeset"));
|
||||||
|
|
||||||
out:
|
|
||||||
VIR_FREE(args);
|
|
||||||
virCommandFree(cmd);
|
virCommandFree(cmd);
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user