mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-12 15:52:55 +00:00
util: split out VIR_ALLOC calls
To make the following commits simpler. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
0a46abaa4f
commit
2566345a5c
@ -2636,8 +2636,10 @@ virCommandRunAsync(virCommandPtr cmd, pid_t *pid)
|
||||
VIR_FORCE_CLOSE(cmd->infd);
|
||||
/* clear any error so we can catch if the helper thread reports one */
|
||||
cmd->has_error = 0;
|
||||
if (VIR_ALLOC(cmd->asyncioThread) < 0 ||
|
||||
virThreadCreateFull(cmd->asyncioThread, true,
|
||||
if (VIR_ALLOC(cmd->asyncioThread) < 0)
|
||||
ret = -1;
|
||||
|
||||
if (virThreadCreateFull(cmd->asyncioThread, true,
|
||||
virCommandDoAsyncIOHelper,
|
||||
"cmd-async-io", false, cmd) < 0) {
|
||||
virReportSystemError(errno, "%s",
|
||||
|
@ -672,12 +672,10 @@ virXPathNodeSet(const char *xpath,
|
||||
|
||||
ret = obj->nodesetval->nodeNr;
|
||||
if (list != NULL && ret) {
|
||||
if (VIR_ALLOC_N(*list, ret) < 0) {
|
||||
ret = -1;
|
||||
} else {
|
||||
memcpy(*list, obj->nodesetval->nodeTab,
|
||||
ret * sizeof(xmlNodePtr));
|
||||
}
|
||||
if (VIR_ALLOC_N(*list, ret) < 0)
|
||||
return -1;
|
||||
|
||||
memcpy(*list, obj->nodesetval->nodeTab, ret * sizeof(xmlNodePtr));
|
||||
}
|
||||
xmlXPathFreeObject(obj);
|
||||
return ret;
|
||||
|
Loading…
x
Reference in New Issue
Block a user