To make the following commits simpler.
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
src/util/vircommand.c | 6 ++++--
src/util/virxml.c | 10 ++++------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/util/vircommand.c b/src/util/vircommand.c
index 859d6b0ce5..8060cdfada 100644
--- a/src/util/vircommand.c
+++ b/src/util/vircommand.c
@@ -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",
diff --git a/src/util/virxml.c b/src/util/virxml.c
index 5315d4ff6f..1927ff490f 100644
--- a/src/util/virxml.c
+++ b/src/util/virxml.c
@@ -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;
--
2.26.2