Move them to separate conditions to reduce churn
in following patches.
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
src/qemu/qemu_domain.c | 6 ++++--
src/qemu/qemu_monitor_json.c | 6 ++++--
src/qemu/qemu_process.c | 23 ++++++++++++-----------
3 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 0331fd55e0..491fb0ed3d 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3719,8 +3719,10 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
if (j == def->npanics) {
virDomainPanicDefPtr panic;
- if (VIR_ALLOC(panic) < 0 ||
- VIR_APPEND_ELEMENT_COPY(def->panics,
+ if (VIR_ALLOC(panic) < 0)
+ return -1;
+
+ if (VIR_APPEND_ELEMENT_COPY(def->panics,
def->npanics, panic) < 0) {
VIR_FREE(panic);
return -1;
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index bc242c798b..c399100dbe 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -4890,8 +4890,10 @@ qemuMonitorJSONParseBlockJobInfo(virHashTablePtr blockJobs,
if (!rawjobname)
device = qemuAliasDiskDriveSkipPrefix(device);
- if (VIR_ALLOC(info) < 0 ||
- virHashAddEntry(blockJobs, device, info) < 0) {
+ if (VIR_ALLOC(info) < 0)
+ return -1;
+
+ if (virHashAddEntry(blockJobs, device, info) < 0) {
VIR_FREE(info);
return -1;
}
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 9122069cc9..93cbb37986 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -832,17 +832,18 @@ qemuProcessHandleWatchdog(qemuMonitorPtr mon G_GNUC_UNUSED,
if (vm->def->watchdog->action == VIR_DOMAIN_WATCHDOG_ACTION_DUMP) {
struct qemuProcessEvent *processEvent;
- if (VIR_ALLOC(processEvent) == 0) {
- processEvent->eventType = QEMU_PROCESS_EVENT_WATCHDOG;
- processEvent->action = VIR_DOMAIN_WATCHDOG_ACTION_DUMP;
- /* Hold an extra reference because we can't allow 'vm' to be
- * deleted before handling watchdog event is finished.
- */
- processEvent->vm = virObjectRef(vm);
- if (virThreadPoolSendJob(driver->workerPool, 0, processEvent) < 0) {
- virObjectUnref(vm);
- qemuProcessEventFree(processEvent);
- }
+ if (VIR_ALLOC(processEvent) < 0)
+ ;
+
+ processEvent->eventType = QEMU_PROCESS_EVENT_WATCHDOG;
+ processEvent->action = VIR_DOMAIN_WATCHDOG_ACTION_DUMP;
+ /* Hold an extra reference because we can't allow 'vm' to be
+ * deleted before handling watchdog event is finished.
+ */
+ processEvent->vm = virObjectRef(vm);
+ if (virThreadPoolSendJob(driver->workerPool, 0, processEvent) < 0) {
+ virObjectUnref(vm);
+ qemuProcessEventFree(processEvent);
}
}
--
2.26.2