mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-26 14:35:18 +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);
|
VIR_FORCE_CLOSE(cmd->infd);
|
||||||
/* clear any error so we can catch if the helper thread reports one */
|
/* clear any error so we can catch if the helper thread reports one */
|
||||||
cmd->has_error = 0;
|
cmd->has_error = 0;
|
||||||
if (VIR_ALLOC(cmd->asyncioThread) < 0 ||
|
if (VIR_ALLOC(cmd->asyncioThread) < 0)
|
||||||
virThreadCreateFull(cmd->asyncioThread, true,
|
ret = -1;
|
||||||
|
|
||||||
|
if (virThreadCreateFull(cmd->asyncioThread, true,
|
||||||
virCommandDoAsyncIOHelper,
|
virCommandDoAsyncIOHelper,
|
||||||
"cmd-async-io", false, cmd) < 0) {
|
"cmd-async-io", false, cmd) < 0) {
|
||||||
virReportSystemError(errno, "%s",
|
virReportSystemError(errno, "%s",
|
||||||
|
@ -672,12 +672,10 @@ virXPathNodeSet(const char *xpath,
|
|||||||
|
|
||||||
ret = obj->nodesetval->nodeNr;
|
ret = obj->nodesetval->nodeNr;
|
||||||
if (list != NULL && ret) {
|
if (list != NULL && ret) {
|
||||||
if (VIR_ALLOC_N(*list, ret) < 0) {
|
if (VIR_ALLOC_N(*list, ret) < 0)
|
||||||
ret = -1;
|
return -1;
|
||||||
} else {
|
|
||||||
memcpy(*list, obj->nodesetval->nodeTab,
|
memcpy(*list, obj->nodesetval->nodeTab, ret * sizeof(xmlNodePtr));
|
||||||
ret * sizeof(xmlNodePtr));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
xmlXPathFreeObject(obj);
|
xmlXPathFreeObject(obj);
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user