[PATCH v2 20/37] Adapt to VIR_ALLOC and virAsprintf in src/qemu/*

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 src/qemu/qemu_agent.c        |  42 ++---
 src/qemu/qemu_capabilities.c |  69 +++------
 src/qemu/qemu_cgroup.c       |   4 +-
 src/qemu/qemu_command.c      | 357 +++++++++++++++----------------------------
 src/qemu/qemu_conf.c         |  88 ++++-------
 src/qemu/qemu_domain.c       |  50 ++----
 src/qemu/qemu_driver.c       | 124 ++++-----------
 src/qemu/qemu_hotplug.c      |  84 +++-------
 src/qemu/qemu_migration.c    |  94 +++---------
 src/qemu/qemu_monitor.c      |  33 +---
 src/qemu/qemu_monitor_json.c | 118 +++++---------
 src/qemu/qemu_monitor_text.c | 233 +++++++---------------------
 src/qemu/qemu_process.c      |  70 +++------
 13 files changed, 394 insertions(+), 972 deletions(-)

diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index 9914521..80cccf9 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -514,10 +514,8 @@ qemuAgentIORead(qemuAgentPtr mon)
 
     if (avail < 1024) {
         if (VIR_REALLOC_N(mon->buffer,
-                          mon->bufferLength + 1024) < 0) {
-            virReportOOMError();
+                          mon->bufferLength + 1024) < 0)
             return -1;
-        }
         mon->bufferLength += 1024;
         avail += 1024;
     }
@@ -919,10 +917,8 @@ qemuAgentGuestSync(qemuAgentPtr mon)
 
     if (virAsprintf(&sync_msg.txBuffer,
                     "{\"execute\":\"guest-sync\", "
-                    "\"arguments\":{\"id\":%llu}}", id) < 0) {
-        virReportOOMError();
+                    "\"arguments\":{\"id\":%llu}}", id) < 0)
         return -1;
-    }
 
     sync_msg.txLength = strlen(sync_msg.txBuffer);
 
@@ -988,10 +984,8 @@ qemuAgentCommand(qemuAgentPtr mon,
 
     if (!(cmdstr = virJSONValueToString(cmd, false)))
         goto cleanup;
-    if (virAsprintf(&msg.txBuffer, "%s" LINE_ENDING, cmdstr) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&msg.txBuffer, "%s" LINE_ENDING, cmdstr) < 0)
         goto cleanup;
-    }
     msg.txLength = strlen(msg.txBuffer);
 
     VIR_DEBUG("Send command '%s' for write, seconds = %d", cmdstr, seconds);
@@ -1147,10 +1141,10 @@ qemuAgentMakeCommand(const char *cmdname,
     va_start(args, cmdname);
 
     if (!(obj = virJSONValueNewObject()))
-        goto no_memory;
+        goto error;
 
     if (virJSONValueObjectAppendString(obj, "execute", cmdname) < 0)
-        goto no_memory;
+        goto error;
 
     while ((key = va_arg(args, char *)) != NULL) {
         int ret;
@@ -1169,7 +1163,7 @@ qemuAgentMakeCommand(const char *cmdname,
 
         if (!jargs &&
             !(jargs = virJSONValueNewObject()))
-            goto no_memory;
+            goto error;
 
         /* This doesn't support maps/arrays.  This hasn't
          * proved to be a problem..... yet :-)  */
@@ -1220,19 +1214,17 @@ qemuAgentMakeCommand(const char *cmdname,
             goto error;
         }
         if (ret < 0)
-            goto no_memory;
+            goto error;
     }
 
     if (jargs &&
         virJSONValueObjectAppend(obj, "arguments", jargs) < 0)
-        goto no_memory;
+        goto error;
 
     va_end(args);
 
     return obj;
 
-no_memory:
-    virReportOOMError();
 error:
     virJSONValueFree(obj);
     virJSONValueFree(jargs);
@@ -1497,10 +1489,8 @@ qemuAgentGetVCPUs(qemuAgentPtr mon,
 
     ndata = virJSONValueArraySize(data);
 
-    if (VIR_ALLOC_N(*info, ndata) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC_N(*info, ndata) < 0)
         goto cleanup;
-    }
 
     for (i = 0; i < ndata; i++) {
         virJSONValuePtr entry = virJSONValueArrayGet(data, i);
@@ -1562,23 +1552,23 @@ qemuAgentSetVCPUs(qemuAgentPtr mon,
 
     /* create the key data array */
     if (!(cpus = virJSONValueNewArray()))
-        goto no_memory;
+        goto cleanup;
 
     for (i = 0; i < ninfo; i++) {
         qemuAgentCPUInfoPtr in = &info[i];
 
         /* create single cpu object */
         if (!(cpu = virJSONValueNewObject()))
-            goto no_memory;
+            goto cleanup;
 
         if (virJSONValueObjectAppendNumberInt(cpu, "logical-id", in->id) < 0)
-            goto no_memory;
+            goto cleanup;
 
         if (virJSONValueObjectAppendBoolean(cpu, "online", in->online) < 0)
-            goto no_memory;
+            goto cleanup;
 
         if (virJSONValueArrayAppend(cpus, cpu) < 0)
-            goto no_memory;
+            goto cleanup;
 
         cpu = NULL;
     }
@@ -1606,8 +1596,4 @@ cleanup:
     virJSONValueFree(cpu);
     virJSONValueFree(cpus);
     return ret;
-
-no_memory:
-    virReportOOMError();
-    goto cleanup;
 }
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 969b001..594ef97 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -400,7 +400,6 @@ virQEMUCapsParseMachineTypesStr(const char *output,
             VIR_REALLOC_N(qemuCaps->machineMaxCpus, qemuCaps->nmachineTypes + 1) < 0) {
             VIR_FREE(name);
             VIR_FREE(canonical);
-            virReportOOMError();
             return -1;
         }
         qemuCaps->nmachineTypes++;
@@ -499,10 +498,8 @@ virQEMUCapsParseX86Models(const char *output,
         if (*p == '\0' || *p == '\n')
             continue;
 
-        if (VIR_EXPAND_N(qemuCaps->cpuDefinitions, qemuCaps->ncpuDefinitions, 1) < 0) {
-            virReportOOMError();
+        if (VIR_EXPAND_N(qemuCaps->cpuDefinitions, qemuCaps->ncpuDefinitions, 1) < 0)
             goto cleanup;
-        }
 
         if (next)
             len = next - p - 1;
@@ -558,10 +555,8 @@ virQEMUCapsParsePPCModels(const char *output,
         if (*p == '\n')
             continue;
 
-        if (VIR_EXPAND_N(qemuCaps->cpuDefinitions, qemuCaps->ncpuDefinitions, 1) < 0) {
-            virReportOOMError();
+        if (VIR_EXPAND_N(qemuCaps->cpuDefinitions, qemuCaps->ncpuDefinitions, 1) < 0)
             goto cleanup;
-        }
 
         len = t - p - 1;
 
@@ -622,10 +617,8 @@ virQEMUCapsFindBinaryForArch(virArch hostarch,
     const char *archstr = virQEMUCapsArchToString(guestarch);
     char *binary;
 
-    if (virAsprintf(&binary, "qemu-system-%s", archstr) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&binary, "qemu-system-%s", archstr) < 0)
         return NULL;
-    }
 
     ret = virFindFileInPath(binary);
     VIR_FREE(binary);
@@ -842,10 +835,8 @@ virQEMUCapsInitCPU(virCapsPtr caps,
     virNodeInfo nodeinfo;
     int ret = -1;
 
-    if (VIR_ALLOC(cpu) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC(cpu) < 0)
         goto error;
-    }
 
     cpu->arch = arch;
 
@@ -1536,10 +1527,8 @@ virQEMUCapsParseDeviceStrObjectTypes(const char *str,
             goto cleanup;
         }
 
-        if (VIR_EXPAND_N(typelist, ntypelist, 1) < 0) {
-            virReportOOMError();
+        if (VIR_EXPAND_N(typelist, ntypelist, 1) < 0)
             goto cleanup;
-        }
         if (VIR_STRNDUP(typelist[ntypelist - 1], tmp, end-tmp) < 0)
             goto cleanup;
     }
@@ -1591,10 +1580,8 @@ virQEMUCapsParseDeviceStrObjectProps(const char *str,
                            _("Malformed QEMU device list string, missing '='"));
             goto cleanup;
         }
-        if (VIR_EXPAND_N(proplist, nproplist, 1) < 0) {
-            virReportOOMError();
+        if (VIR_EXPAND_N(proplist, nproplist, 1) < 0)
             goto cleanup;
-        }
         if (VIR_STRNDUP(proplist[nproplist - 1], tmp, end-tmp) < 0)
             goto cleanup;
     }
@@ -1735,12 +1722,11 @@ virQEMUCapsNew(void)
         return NULL;
 
     if (!(qemuCaps->flags = virBitmapNew(QEMU_CAPS_LAST)))
-        goto no_memory;
+        goto error;
 
     return qemuCaps;
 
-no_memory:
-    virReportOOMError();
+error:
     virObjectUnref(qemuCaps);
     return NULL;
 }
@@ -1762,7 +1748,7 @@ virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr qemuCaps)
     ret->arch = qemuCaps->arch;
 
     if (VIR_ALLOC_N(ret->cpuDefinitions, qemuCaps->ncpuDefinitions) < 0)
-        goto no_memory;
+        goto error;
     ret->ncpuDefinitions = qemuCaps->ncpuDefinitions;
     for (i = 0; i < qemuCaps->ncpuDefinitions; i++) {
         if (VIR_STRDUP(ret->cpuDefinitions[i], qemuCaps->cpuDefinitions[i]) < 0)
@@ -1770,11 +1756,11 @@ virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr qemuCaps)
     }
 
     if (VIR_ALLOC_N(ret->machineTypes, qemuCaps->nmachineTypes) < 0)
-        goto no_memory;
+        goto error;
     if (VIR_ALLOC_N(ret->machineAliases, qemuCaps->nmachineTypes) < 0)
-        goto no_memory;
+        goto error;
     if (VIR_ALLOC_N(ret->machineMaxCpus, qemuCaps->nmachineTypes) < 0)
-        goto no_memory;
+        goto error;
     ret->nmachineTypes = qemuCaps->nmachineTypes;
     for (i = 0; i < qemuCaps->nmachineTypes; i++) {
         if (VIR_STRDUP(ret->machineTypes[i], qemuCaps->machineTypes[i]) < 0 ||
@@ -1785,8 +1771,6 @@ virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr qemuCaps)
 
     return ret;
 
-no_memory:
-    virReportOOMError();
 error:
     virObjectUnref(ret);
     return NULL;
@@ -1896,7 +1880,6 @@ int virQEMUCapsAddCPUDefinition(virQEMUCapsPtr qemuCaps,
         return -1;
     if (VIR_EXPAND_N(qemuCaps->cpuDefinitions, qemuCaps->ncpuDefinitions, 1) < 0) {
         VIR_FREE(tmp);
-        virReportOOMError();
         return -1;
     }
     qemuCaps->cpuDefinitions[qemuCaps->ncpuDefinitions-1] = tmp;
@@ -2108,18 +2091,12 @@ virQEMUCapsProbeQMPMachineTypes(virQEMUCapsPtr qemuCaps,
     if ((nmachines = qemuMonitorGetMachines(mon, &machines)) < 0)
         goto cleanup;
 
-    if (VIR_ALLOC_N(qemuCaps->machineTypes, nmachines) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC_N(qemuCaps->machineTypes, nmachines) < 0)
         goto cleanup;
-    }
-    if (VIR_ALLOC_N(qemuCaps->machineAliases, nmachines) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC_N(qemuCaps->machineAliases, nmachines) < 0)
         goto cleanup;
-    }
-    if (VIR_ALLOC_N(qemuCaps->machineMaxCpus, nmachines) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC_N(qemuCaps->machineMaxCpus, nmachines) < 0)
         goto cleanup;
-    }
 
     for (i = 0; i < nmachines; i++) {
         if (VIR_STRDUP(qemuCaps->machineAliases[i], machines[i]->alias) < 0 ||
@@ -2506,14 +2483,10 @@ virQEMUCapsInitQMP(virQEMUCapsPtr qemuCaps,
     /* the ".sock" sufix is important to avoid a possible clash with a qemu
      * domain called "capabilities"
      */
-    if (virAsprintf(&monpath, "%s/%s", libDir, "capabilities.monitor.sock") < 0) {
-        virReportOOMError();
+    if (virAsprintf(&monpath, "%s/%s", libDir, "capabilities.monitor.sock") < 0)
         goto cleanup;
-    }
-    if (virAsprintf(&monarg, "unix:%s,server,nowait", monpath) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&monarg, "unix:%s,server,nowait", monpath) < 0)
         goto cleanup;
-    }
 
     /* ".pidfile" suffix is used rather than ".pid" to avoid a possible clash
      * with a qemu domain called "capabilities"
@@ -2521,10 +2494,8 @@ virQEMUCapsInitQMP(virQEMUCapsPtr qemuCaps,
      * -daemonize we need QEMU to be allowed to create them, rather
      * than libvirtd. So we're using libDir which QEMU can write to
      */
-    if (virAsprintf(&pidfile, "%s/%s", libDir, "capabilities.pidfile") < 0) {
-        virReportOOMError();
+    if (virAsprintf(&pidfile, "%s/%s", libDir, "capabilities.pidfile") < 0)
         goto cleanup;
-    }
 
     memset(&config, 0, sizeof(config));
     config.type = VIR_DOMAIN_CHR_TYPE_UNIX;
@@ -2744,10 +2715,8 @@ virQEMUCapsCacheNew(const char *libDir,
 {
     virQEMUCapsCachePtr cache;
 
-    if (VIR_ALLOC(cache) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC(cache) < 0)
         return NULL;
-    }
 
     if (virMutexInit(&cache->lock) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 22bf78e..4177e23 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -706,10 +706,8 @@ int qemuInitCgroup(virQEMUDriverPtr driver,
     if (!vm->def->resource && startup) {
         virDomainResourceDefPtr res;
 
-        if (VIR_ALLOC(res) < 0) {
-            virReportOOMError();
+        if (VIR_ALLOC(res) < 0)
             goto cleanup;
-        }
 
         if (VIR_STRDUP(res->partition, "/machine") < 0) {
             VIR_FREE(res);
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 46db28a..325ef38 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -545,10 +545,8 @@ qemuNetworkPrepareDevices(virDomainDefPtr def)
                                def->name);
                 goto cleanup;
             }
-            if (virDomainHostdevInsert(def, hostdev) < 0) {
-                virReportOOMError();
+            if (virDomainHostdevInsert(def, hostdev) < 0)
                 goto cleanup;
-            }
         }
     }
     ret = 0;
@@ -599,10 +597,8 @@ char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk,
     char *ret;
 
     if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
-        if (virAsprintf(&ret, "%s%s", QEMU_DRIVE_HOST_PREFIX, disk->info.alias) < 0) {
-            virReportOOMError();
-            return NULL;
-        }
+        ignore_value(virAsprintf(&ret, "%s%s", QEMU_DRIVE_HOST_PREFIX,
+                                 disk->info.alias));
     } else {
         ignore_value(VIR_STRDUP(ret, disk->info.alias));
     }
@@ -653,10 +649,8 @@ static int qemuAssignDeviceDiskAliasFixed(virDomainDiskDefPtr disk)
         return -1;
     }
 
-    if (ret == -1) {
-        virReportOOMError();
+    if (ret == -1)
         return -1;
-    }
 
     disk->info.alias = dev_name;
 
@@ -744,26 +738,22 @@ qemuAssignDeviceDiskAliasCustom(virDomainDefPtr def,
                             disk->info.addr.drive.controller,
                             disk->info.addr.drive.bus,
                             disk->info.addr.drive.unit) < 0)
-                goto no_memory;
+                return -1;
         } else {
             if (virAsprintf(&disk->info.alias, "%s%d-%d-%d-%d", prefix,
                             disk->info.addr.drive.controller,
                             disk->info.addr.drive.bus,
                             disk->info.addr.drive.target,
                             disk->info.addr.drive.unit) < 0)
-                goto no_memory;
+                return -1;
         }
     } else {
         int idx = virDiskNameToIndex(disk->dst);
         if (virAsprintf(&disk->info.alias, "%s-disk%d", prefix, idx) < 0)
-            goto no_memory;
+            return -1;
     }
 
     return 0;
-
-no_memory:
-    virReportOOMError();
-    return -1;
 }
 
 
@@ -806,12 +796,7 @@ qemuAssignDeviceNetAlias(virDomainDefPtr def, virDomainNetDefPtr net, int idx)
         }
     }
 
-    if (virAsprintf(&net->info.alias, "net%d", idx) < 0) {
-        virReportOOMError();
-        return -1;
-    }
-
-    return 0;
+    return virAsprintf(&net->info.alias, "net%d", idx);
 }
 
 
@@ -838,12 +823,9 @@ qemuAssignDeviceHostdevAlias(virDomainDefPtr def, virDomainHostdevDefPtr hostdev
                         hostdev->source.subsys.u.scsi.adapter,
                         hostdev->source.subsys.u.scsi.bus,
                         hostdev->source.subsys.u.scsi.target,
-                        hostdev->source.subsys.u.scsi.unit) < 0) {
-            virReportOOMError();
+                        hostdev->source.subsys.u.scsi.unit) < 0)
             return -1;
-        }
     } else if (virAsprintf(&hostdev->info->alias, "hostdev%d", idx) < 0) {
-        virReportOOMError();
         return -1;
     }
 
@@ -869,12 +851,7 @@ qemuAssignDeviceRedirdevAlias(virDomainDefPtr def, virDomainRedirdevDefPtr redir
         }
     }
 
-    if (virAsprintf(&redirdev->info.alias, "redir%d", idx) < 0) {
-        virReportOOMError();
-        return -1;
-    }
-
-    return 0;
+    return virAsprintf(&redirdev->info.alias, "redir%d", idx);
 }
 
 
@@ -883,13 +860,7 @@ qemuAssignDeviceControllerAlias(virDomainControllerDefPtr controller)
 {
     const char *prefix = virDomainControllerTypeToString(controller->type);
 
-    if (virAsprintf(&controller->info.alias,  "%s%d", prefix,
-                    controller->idx) < 0) {
-        virReportOOMError();
-        return -1;
-    }
-
-    return 0;
+    return virAsprintf(&controller->info.alias, "%s%d", prefix, controller->idx);
 }
 
 
@@ -920,11 +891,11 @@ qemuAssignDeviceAliases(virDomainDefPtr def, virQEMUCapsPtr qemuCaps)
 
     for (i = 0; i < def->nfss; i++) {
         if (virAsprintf(&def->fss[i]->info.alias, "fs%d", i) < 0)
-            goto no_memory;
+            return -1;
     }
     for (i = 0; i < def->nsounds; i++) {
         if (virAsprintf(&def->sounds[i]->info.alias, "sound%d", i) < 0)
-            goto no_memory;
+            return -1;
     }
     for (i = 0; i < def->nhostdevs; i++) {
         if (qemuAssignDeviceHostdevAlias(def, def->hostdevs[i], i) < 0)
@@ -936,7 +907,7 @@ qemuAssignDeviceAliases(virDomainDefPtr def, virQEMUCapsPtr qemuCaps)
     }
     for (i = 0; i < def->nvideos; i++) {
         if (virAsprintf(&def->videos[i]->info.alias, "video%d", i) < 0)
-            goto no_memory;
+            return -1;
     }
     for (i = 0; i < def->ncontrollers; i++) {
         if (qemuAssignDeviceControllerAlias(def->controllers[i]) < 0)
@@ -944,54 +915,50 @@ qemuAssignDeviceAliases(virDomainDefPtr def, virQEMUCapsPtr qemuCaps)
     }
     for (i = 0; i < def->ninputs; i++) {
         if (virAsprintf(&def->inputs[i]->info.alias, "input%d", i) < 0)
-            goto no_memory;
+            return -1;
     }
     for (i = 0; i < def->nparallels; i++) {
         if (virAsprintf(&def->parallels[i]->info.alias, "parallel%d", i) < 0)
-            goto no_memory;
+            return -1;
     }
     for (i = 0; i < def->nserials; i++) {
         if (virAsprintf(&def->serials[i]->info.alias, "serial%d", i) < 0)
-            goto no_memory;
+            return -1;
     }
     for (i = 0; i < def->nchannels; i++) {
         if (virAsprintf(&def->channels[i]->info.alias, "channel%d", i) < 0)
-            goto no_memory;
+            return -1;
     }
     for (i = 0; i < def->nconsoles; i++) {
         if (virAsprintf(&def->consoles[i]->info.alias, "console%d", i) < 0)
-            goto no_memory;
+            return -1;
     }
     for (i = 0; i < def->nhubs; i++) {
         if (virAsprintf(&def->hubs[i]->info.alias, "hub%d", i) < 0)
-            goto no_memory;
+            return -1;
     }
     for (i = 0; i < def->nsmartcards; i++) {
         if (virAsprintf(&def->smartcards[i]->info.alias, "smartcard%d", i) < 0)
-            goto no_memory;
+            return -1;
     }
     if (def->watchdog) {
         if (virAsprintf(&def->watchdog->info.alias, "watchdog%d", 0) < 0)
-            goto no_memory;
+            return -1;
     }
     if (def->memballoon) {
         if (virAsprintf(&def->memballoon->info.alias, "balloon%d", 0) < 0)
-            goto no_memory;
+            return -1;
     }
     if (def->rng) {
         if (virAsprintf(&def->rng->info.alias, "rng%d", 0) < 0)
-            goto no_memory;
+            return -1;
     }
     if (def->tpm) {
         if (virAsprintf(&def->tpm->info.alias, "tpm%d", 0) < 0)
-            goto no_memory;
+            return -1;
     }
 
     return 0;
-
-no_memory:
-    virReportOOMError();
-    return -1;
 }
 
 /* S390 ccw bus support */
@@ -1006,14 +973,10 @@ qemuCCWAddressAsString(virDomainDeviceCCWAddressPtr addr)
 {
     char *addrstr = NULL;
 
-    if (virAsprintf(&addrstr, "%x.%x.%04x",
-                    addr->cssid,
-                    addr->ssid,
-                    addr->devno) < 0) {
-        virReportOOMError();
-        return NULL;
-    }
-
+    ignore_value(virAsprintf(&addrstr, "%x.%x.%04x",
+                             addr->cssid,
+                             addr->ssid,
+                             addr->devno));
     return addrstr;
 }
 
@@ -1189,7 +1152,7 @@ qemuDomainCCWAddressSetCreate(void)
      qemuDomainCCWAddressSetPtr addrs = NULL;
 
     if (VIR_ALLOC(addrs) < 0)
-        goto no_memory;
+        goto cleanup;
 
     if (!(addrs->defined = virHashCreate(10, qemuDomainCCWAddressSetFreeEntry)))
         goto cleanup;
@@ -1201,8 +1164,6 @@ qemuDomainCCWAddressSetCreate(void)
     addrs->next.assigned = 0;
     return addrs;
 
-no_memory:
-    virReportOOMError();
 cleanup:
     qemuDomainCCWAddressSetFree(addrs);
     return addrs;
@@ -1456,10 +1417,8 @@ qemuDomainPCIAddressSetGrow(qemuDomainPCIAddressSetPtr addrs,
     i = addrs->nbuses;
     if (add <= 0)
         return 0;
-    if (VIR_EXPAND_N(addrs->used, addrs->nbuses, add) < 0) {
-        virReportOOMError();
+    if (VIR_EXPAND_N(addrs->used, addrs->nbuses, add) < 0)
         return -1;
-    }
     /* reserve slot 0 on the new buses */
     for (; i < addrs->nbuses; i++)
         addrs->used[i][0] = 0xFF;
@@ -1471,14 +1430,11 @@ static char *qemuPCIAddressAsString(virDevicePCIAddressPtr addr)
 {
     char *str;
 
-    if (virAsprintf(&str, "%.4x:%.2x:%.2x.%.1x",
-                    addr->domain,
-                    addr->bus,
-                    addr->slot,
-                    addr->function) < 0) {
-        virReportOOMError();
-        return NULL;
-    }
+    ignore_value(virAsprintf(&str, "%.4x:%.2x:%.2x.%.1x",
+                             addr->domain,
+                             addr->bus,
+                             addr->slot,
+                             addr->function));
     return str;
 }
 
@@ -1677,10 +1633,10 @@ qemuDomainPCIAddressSetPtr qemuDomainPCIAddressSetCreate(virDomainDefPtr def,
     int i;
 
     if (VIR_ALLOC(addrs) < 0)
-        goto no_memory;
+        goto error;
 
     if (VIR_ALLOC_N(addrs->used, nbuses) < 0)
-        goto no_memory;
+        goto error;
 
     addrs->nbuses = nbuses;
     addrs->dryRun = dryRun;
@@ -1695,8 +1651,6 @@ qemuDomainPCIAddressSetPtr qemuDomainPCIAddressSetCreate(virDomainDefPtr def,
 
     return addrs;
 
-no_memory:
-    virReportOOMError();
 error:
     qemuDomainPCIAddressSetFree(addrs);
     return NULL;
@@ -2508,7 +2462,7 @@ static int qemuAddRBDHost(virDomainDiskDefPtr disk, char *hostport)
 
     disk->nhosts++;
     if (VIR_REALLOC_N(disk->hosts, disk->nhosts) < 0)
-        goto no_memory;
+        goto error;
 
     if ((port = strchr(hostport, ']'))) {
         /* ipv6, strip brackets */
@@ -2531,19 +2485,17 @@ static int qemuAddRBDHost(virDomainDiskDefPtr disk, char *hostport)
 
     parts = virStringSplit(hostport, "\\:", 0);
     if (!parts)
-        goto no_memory;
+        goto error;
     disk->hosts[disk->nhosts-1].name = virStringJoin((const char **)parts, ":");
     virStringFreeList(parts);
     if (!disk->hosts[disk->nhosts-1].name)
-        goto no_memory;
+        goto error;
 
     disk->hosts[disk->nhosts-1].transport = VIR_DOMAIN_DISK_PROTO_TRANS_TCP;
     disk->hosts[disk->nhosts-1].socket = NULL;
 
     return 0;
 
-no_memory:
-    virReportOOMError();
 error:
     VIR_FREE(disk->hosts[disk->nhosts-1].port);
     VIR_FREE(disk->hosts[disk->nhosts-1].name);
@@ -2629,7 +2581,7 @@ qemuParseDriveURIString(virDomainDiskDefPtr def, virURIPtr uri,
     char *secret = NULL;
 
     if (VIR_ALLOC(def->hosts) < 0)
-        goto no_memory;
+        goto error;
 
     transp = strchr(uri->scheme, '+');
     if (transp)
@@ -2658,7 +2610,7 @@ qemuParseDriveURIString(virDomainDiskDefPtr def, virURIPtr uri,
             goto error;
 
         if (virAsprintf(&def->hosts->port, "%d", uri->port) < 0)
-            goto no_memory;
+            goto error;
     } else {
         def->hosts->name = NULL;
         def->hosts->port = 0;
@@ -2701,8 +2653,6 @@ cleanup:
 
     return ret;
 
-no_memory:
-    virReportOOMError();
 error:
     virDomainDiskHostDefFree(def->hosts);
     VIR_FREE(def->hosts);
@@ -2761,7 +2711,7 @@ qemuParseNBDString(virDomainDiskDefPtr disk)
     }
 
     if (VIR_ALLOC(h) < 0)
-        goto no_memory;
+        goto error;
 
     host = disk->src + strlen("nbd:");
     if (STRPREFIX(host, "unix:/")) {
@@ -2805,8 +2755,6 @@ qemuParseNBDString(virDomainDiskDefPtr disk)
     disk->hosts = h;
     return 0;
 
-no_memory:
-    virReportOOMError();
 error:
     virDomainDiskHostDefFree(h);
     VIR_FREE(h);
@@ -2848,11 +2796,11 @@ qemuBuildDriveURIString(virConnectPtr conn,
             goto cleanup;
     } else {
         if (virAsprintf(&tmpscheme, "%s+%s", scheme, transp) < 0)
-            goto no_memory;
+            goto cleanup;
     }
 
     if (disk->src && virAsprintf(&volimg, "/%s", disk->src) < 0)
-        goto no_memory;
+        goto cleanup;
 
     if (disk->hosts->port) {
         port = atoi(disk->hosts->port);
@@ -2860,7 +2808,7 @@ qemuBuildDriveURIString(virConnectPtr conn,
 
     if (disk->hosts->socket &&
         virAsprintf(&sock, "socket=%s", disk->hosts->socket) < 0)
-        goto no_memory;
+        goto cleanup;
 
     if (disk->auth.username && secretType != VIR_SECRET_USAGE_TYPE_NONE) {
         /* look up secret */
@@ -2886,7 +2834,7 @@ qemuBuildDriveURIString(virConnectPtr conn,
                 goto cleanup;
             }
             if (virAsprintf(&user, "%s:%s", disk->auth.username, secret) < 0)
-                goto no_memory;
+                goto cleanup;
         } else {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("%s username '%s' specified but secret not found"),
@@ -2917,10 +2865,6 @@ cleanup:
     VIR_FREE(user);
 
     return ret;
-
-no_memory:
-    virReportOOMError();
-    goto cleanup;
 }
 
 static int
@@ -4025,19 +3969,15 @@ qemuBuildNicStr(virDomainNetDefPtr net,
     char *str;
     char macaddr[VIR_MAC_STRING_BUFLEN];
 
-    if (virAsprintf(&str,
-                    "%smacaddr=%s,vlan=%d%s%s%s%s",
-                    prefix ? prefix : "",
-                    virMacAddrFormat(&net->mac, macaddr),
-                    vlan,
-                    (net->model ? ",model=" : ""),
-                    (net->model ? net->model : ""),
-                    (net->info.alias ? ",name=" : ""),
-                    (net->info.alias ? net->info.alias : "")) < 0) {
-        virReportOOMError();
-        return NULL;
-    }
-
+    ignore_value(virAsprintf(&str,
+                             "%smacaddr=%s,vlan=%d%s%s%s%s",
+                             prefix ? prefix : "",
+                             virMacAddrFormat(&net->mac, macaddr),
+                             vlan,
+                             (net->model ? ",model=" : ""),
+                             (net->model ? net->model : ""),
+                             (net->info.alias ? ",name=" : ""),
+                             (net->info.alias ? net->info.alias : "")));
     return str;
 }
 
@@ -4540,10 +4480,8 @@ qemuOpenPCIConfig(virDomainHostdevDefPtr dev)
                     dev->source.subsys.u.pci.addr.domain,
                     dev->source.subsys.u.pci.addr.bus,
                     dev->source.subsys.u.pci.addr.slot,
-                    dev->source.subsys.u.pci.addr.function) < 0) {
-        virReportOOMError();
+                    dev->source.subsys.u.pci.addr.function) < 0)
         return -1;
-    }
 
     configfd = open(path, O_RDWR, 0);
 
@@ -4599,12 +4537,10 @@ qemuBuildPCIHostdevPCIDevStr(virDomainHostdevDefPtr dev)
 {
     char *ret = NULL;
 
-    if (virAsprintf(&ret, "host=%.2x:%.2x.%.1x",
-                    dev->source.subsys.u.pci.addr.bus,
-                    dev->source.subsys.u.pci.addr.slot,
-                    dev->source.subsys.u.pci.addr.function) < 0)
-        virReportOOMError();
-
+    ignore_value(virAsprintf(&ret, "host=%.2x:%.2x.%.1x",
+                             dev->source.subsys.u.pci.addr.bus,
+                             dev->source.subsys.u.pci.addr.slot,
+                             dev->source.subsys.u.pci.addr.function));
     return ret;
 }
 
@@ -4794,11 +4730,9 @@ qemuBuildUSBHostdevUsbDevStr(virDomainHostdevDefPtr dev)
         return NULL;
     }
 
-    if (virAsprintf(&ret, "host:%d.%d",
-                    dev->source.subsys.u.usb.bus,
-                    dev->source.subsys.u.usb.device) < 0)
-        virReportOOMError();
-
+    ignore_value(virAsprintf(&ret, "host:%d.%d",
+                             dev->source.subsys.u.usb.bus,
+                             dev->source.subsys.u.usb.device));
     return ret;
 }
 
@@ -5693,10 +5627,8 @@ qemuBuildCpuArgStr(const virQEMUDriverPtr driver,
             }
             virBufferAddLit(&buf, "host");
         } else {
-            if (VIR_ALLOC(guest) < 0) {
-                virReportOOMError();
+            if (VIR_ALLOC(guest) < 0)
                 goto cleanup;
-            }
             if (VIR_STRDUP(guest->vendor_id, cpu->vendor_id) < 0)
                 goto cleanup;
 
@@ -6092,7 +6024,7 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg,
         if (!graphics->data.vnc.socket &&
             virAsprintf(&graphics->data.vnc.socket,
                         "%s/%s.vnc", cfg->libDir, def->name) == -1)
-            goto no_memory;
+            goto error;
 
         virBufferAsprintf(&opt, "unix:%s", graphics->data.vnc.socket);
 
@@ -6207,8 +6139,6 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg,
 
     return 0;
 
-no_memory:
-    virReportOOMError();
 error:
     VIR_FREE(netAddr);
     virBufferFreeAndReset(&opt);
@@ -6526,19 +6456,15 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
             tapfdSize = 1;
 
         if (VIR_ALLOC_N(tapfd, tapfdSize) < 0 ||
-            VIR_ALLOC_N(tapfdName, tapfdSize) < 0) {
-            virReportOOMError();
+            VIR_ALLOC_N(tapfdName, tapfdSize) < 0)
             goto cleanup;
-        }
 
         if (qemuNetworkIfaceConnect(def, conn, driver, net,
                                     qemuCaps, tapfd, &tapfdSize) < 0)
             goto cleanup;
     } else if (actualType == VIR_DOMAIN_NET_TYPE_DIRECT) {
-        if (VIR_ALLOC(tapfd) < 0 || VIR_ALLOC(tapfdName) < 0) {
-            virReportOOMError();
+        if (VIR_ALLOC(tapfd) < 0 || VIR_ALLOC(tapfdName) < 0)
             goto cleanup;
-        }
         tapfdSize = 1;
         tapfd[0] = qemuPhysIfaceConnect(def, driver, net,
                                         qemuCaps, vmop);
@@ -6557,10 +6483,8 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
             vhostfdSize = 1;
 
         if (VIR_ALLOC_N(vhostfd, vhostfdSize) < 0 ||
-            VIR_ALLOC_N(vhostfdName, vhostfdSize)) {
-            virReportOOMError();
+            VIR_ALLOC_N(vhostfdName, vhostfdSize))
             goto cleanup;
-        }
 
         if (qemuOpenVhostNet(def, net, qemuCaps, vhostfd, &vhostfdSize) < 0)
             goto cleanup;
@@ -6568,18 +6492,14 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
 
     for (i = 0; i < tapfdSize; i++) {
         virCommandTransferFD(cmd, tapfd[i]);
-        if (virAsprintf(&tapfdName[i], "%d", tapfd[i]) < 0) {
-            virReportOOMError();
+        if (virAsprintf(&tapfdName[i], "%d", tapfd[i]) < 0)
             goto cleanup;
-        }
     }
 
     for (i = 0; i < vhostfdSize; i++) {
         virCommandTransferFD(cmd, vhostfd[i]);
-        if (virAsprintf(&vhostfdName[i], "%d", vhostfd[i]) < 0) {
-            virReportOOMError();
+        if (virAsprintf(&vhostfdName[i], "%d", vhostfd[i]) < 0)
             goto cleanup;
-        }
     }
 
     /* Possible combinations:
@@ -7514,10 +7434,8 @@ qemuBuildCommandLine(virConnectPtr conn,
                 else
                     fmt = "fat:%s";
 
-                if (virAsprintf(&file, fmt, disk->src) < 0) {
-                    virReportOOMError();
+                if (virAsprintf(&file, fmt, disk->src) < 0)
                     goto error;
-                }
             } else if (disk->type == VIR_DOMAIN_DISK_TYPE_NETWORK) {
                 virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                                _("network disks are only supported with -drive"));
@@ -8167,10 +8085,8 @@ qemuBuildCommandLine(virConnectPtr conn,
         } else {
             int size = 100;
             char *modstr;
-            if (VIR_ALLOC_N(modstr, size+1) < 0) {
-                virReportOOMError();
+            if (VIR_ALLOC_N(modstr, size+1) < 0)
                 goto error;
-            }
 
             for (i = 0; i < def->nsounds && size > 0; i++) {
                 virDomainSoundDefPtr sound = def->sounds[i];
@@ -8360,7 +8276,6 @@ qemuBuildCommandLine(virConnectPtr conn,
                     if (configfd >= 0) {
                         if (virAsprintf(&configfd_name, "%d", configfd) < 0) {
                             VIR_FORCE_CLOSE(configfd);
-                            virReportOOMError();
                             goto error;
                         }
 
@@ -8694,7 +8609,7 @@ static int qemuStringToArgvEnv(const char *args,
         if (argalloc == argcount) {
             if (VIR_REALLOC_N(arglist, argalloc+10) < 0) {
                 VIR_FREE(arg);
-                goto no_memory;
+                goto error;
             }
             argalloc+=10;
         }
@@ -8717,7 +8632,7 @@ static int qemuStringToArgvEnv(const char *args,
     /* Copy the list of env vars */
     if (envend > 0) {
         if (VIR_REALLOC_N(progenv, envend+1) < 0)
-            goto no_memory;
+            goto error;
         for (i = 0; i < envend; i++) {
             progenv[i] = arglist[i];
             arglist[i] = NULL;
@@ -8727,7 +8642,7 @@ static int qemuStringToArgvEnv(const char *args,
 
     /* Copy the list of argv */
     if (VIR_REALLOC_N(progargv, argcount-envend + 1) < 0)
-        goto no_memory;
+        goto error;
     for (i = envend; i < argcount; i++)
         progargv[i-envend] = arglist[i];
     progargv[i-envend] = NULL;
@@ -8739,8 +8654,6 @@ static int qemuStringToArgvEnv(const char *args,
 
     return 0;
 
-no_memory:
-    virReportOOMError();
 error:
     for (i = 0; progenv && progenv[i]; i++)
         VIR_FREE(progenv[i]);
@@ -8847,7 +8760,7 @@ qemuParseKeywords(const char *str,
                 VIR_REALLOC_N(values, keywordAlloc + 10) < 0) {
                 VIR_FREE(keyword);
                 VIR_FREE(value);
-                goto no_memory;
+                goto error;
             }
             keywordAlloc += 10;
         }
@@ -8864,8 +8777,6 @@ qemuParseKeywords(const char *str,
 
     return keywordCount;
 
-no_memory:
-    virReportOOMError();
 error:
     for (i = 0; i < keywordCount; i++) {
         VIR_FREE(keywords[i]);
@@ -8904,10 +8815,8 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
                                        &values, 0)) < 0)
         return NULL;
 
-    if (VIR_ALLOC(def) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC(def) < 0)
         goto cleanup;
-    }
 
     def->bus = VIR_DOMAIN_DISK_BUS_IDE;
     def->device = VIR_DOMAIN_DISK_DEVICE_DISK;
@@ -8972,10 +8881,8 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
                             goto error;
                         }
                         *vdi++ = '\0';
-                        if (VIR_ALLOC(def->hosts) < 0) {
-                            virReportOOMError();
+                        if (VIR_ALLOC(def->hosts) < 0)
                             goto error;
-                        }
                         def->nhosts = 1;
                         def->hosts->name = def->src;
                         if (VIR_STRDUP(def->hosts->port, port) < 0)
@@ -9259,10 +9166,8 @@ qemuParseCommandLineNet(virDomainXMLOptionPtr xmlopt,
         nkeywords = 0;
     }
 
-    if (VIR_ALLOC(def) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC(def) < 0)
         goto cleanup;
-    }
 
     /* 'tap' could turn into libvirt type=ethernet, type=bridge or
      * type=network, but we can't tell, so use the generic config */
@@ -9544,7 +9449,7 @@ qemuParseCommandLineChr(virDomainChrSourceDefPtr source,
             host2++;
             if (svc2 && svc2 != host2 &&
                 VIR_STRNDUP(source->data.udp.bindHost, host2, svc2 - host2) < 0)
-                goto no_memory;
+                goto error;
         }
 
         if (svc2) {
@@ -9599,8 +9504,6 @@ qemuParseCommandLineChr(virDomainChrSourceDefPtr source,
 
     return 0;
 
-no_memory:
-    virReportOOMError();
 error:
     return -1;
 }
@@ -9612,10 +9515,8 @@ qemuInitGuestCPU(virDomainDefPtr dom)
     if (!dom->cpu) {
         virCPUDefPtr cpu;
 
-        if (VIR_ALLOC(cpu) < 0) {
-            virReportOOMError();
+        if (VIR_ALLOC(cpu) < 0)
             return NULL;
-        }
 
         cpu->type = VIR_CPU_TYPE_GUEST;
         cpu->match = VIR_CPU_MATCH_EXACT;
@@ -9682,7 +9583,7 @@ qemuParseCommandLineCPU(virDomainDefPtr dom,
                 if (j == dom->clock.ntimers) {
                     if (VIR_REALLOC_N(dom->clock.timers, j + 1) < 0 ||
                         VIR_ALLOC(dom->clock.timers[j]) < 0)
-                        goto no_memory;
+                        goto cleanup;
                     dom->clock.timers[j]->name = VIR_DOMAIN_TIMER_NAME_KVMCLOCK;
                     dom->clock.timers[j]->present = present;
                     dom->clock.timers[j]->tickpolicy = -1;
@@ -9806,10 +9707,6 @@ syntax:
     virReportError(VIR_ERR_INTERNAL_ERROR,
                    _("unknown CPU syntax '%s'"), val);
     goto cleanup;
-
-no_memory:
-    virReportOOMError();
-    goto cleanup;
 }
 
 
@@ -9949,11 +9846,11 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
     }
 
     if (VIR_ALLOC(def) < 0)
-        goto no_memory;
+        goto error;
 
     /* allocate the cmdlinedef up-front; if it's unused, we'll free it later */
     if (VIR_ALLOC(cmd) < 0)
-        goto no_memory;
+        goto error;
 
     if (virUUIDGenerate(def->uuid) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -10026,7 +9923,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
             WANT_VALUE();
             if (STRPREFIX(val, "nic")) {
                 if (VIR_REALLOC_N(nics, nnics+1) < 0)
-                    goto no_memory;
+                    goto error;
                 nics[nnics++] = val;
             }
         }
@@ -10045,7 +9942,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
             char *tmp;
             WANT_VALUE();
             if (VIR_ALLOC(vnc) < 0)
-                goto no_memory;
+                goto error;
             vnc->type = VIR_DOMAIN_GRAPHICS_TYPE_VNC;
 
             if (STRPREFIX(val, "unix:")) {
@@ -10088,7 +9985,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
                                                       val, tmp-val, true);
                 if (!virDomainGraphicsListenGetAddress(vnc, 0)) {
                     virDomainGraphicsDefFree(vnc);
-                    goto no_memory;
+                    goto error;
                 }
 
                 if (*opts == ',') {
@@ -10164,7 +10061,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
 
             if (VIR_REALLOC_N(def->graphics, def->ngraphics+1) < 0) {
                 virDomainGraphicsDefFree(vnc);
-                goto no_memory;
+                goto error;
             }
             def->graphics[def->ngraphics++] = vnc;
         } else if (STREQ(arg, "-m")) {
@@ -10193,7 +10090,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
                    STREQ(arg, "-cdrom")) {
             WANT_VALUE();
             if (VIR_ALLOC(disk) < 0)
-                goto no_memory;
+                goto error;
 
             if (STRPREFIX(val, "/dev/"))
                 disk->type = VIR_DOMAIN_DISK_TYPE_BLOCK;
@@ -10263,7 +10160,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
                         }
                         *vdi++ = '\0';
                         if (VIR_ALLOC(disk->hosts) < 0)
-                            goto no_memory;
+                            goto error;
                         disk->nhosts = 1;
                         disk->hosts->name = disk->src;
                         if (VIR_STRDUP(disk->hosts->port, port) < 0)
@@ -10285,10 +10182,6 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
                 }
             }
 
-            if (!(disk->src || disk->nhosts > 0) ||
-                !disk->dst)
-                goto no_memory;
-
             if (virDomainDiskDefAssignAddress(xmlopt, disk) < 0) {
                 virReportError(VIR_ERR_INTERNAL_ERROR,
                                _("Cannot assign address for device name '%s'"),
@@ -10297,7 +10190,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
             }
 
             if (VIR_REALLOC_N(def->disks, def->ndisks+1) < 0)
-                goto no_memory;
+                goto error;
             def->disks[def->ndisks++] = disk;
             disk = NULL;
         } else if (STREQ(arg, "-no-acpi")) {
@@ -10430,7 +10323,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
                 }
                 if (VIR_REALLOC_N(def->serials, def->nserials+1) < 0) {
                     virDomainChrDefFree(chr);
-                    goto no_memory;
+                    goto error;
                 }
                 chr->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL;
                 chr->target.port = def->nserials;
@@ -10450,7 +10343,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
                 }
                 if (VIR_REALLOC_N(def->parallels, def->nparallels+1) < 0) {
                     virDomainChrDefFree(chr);
-                    goto no_memory;
+                    goto error;
                 }
                 chr->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL;
                 chr->target.port = def->nparallels;
@@ -10462,7 +10355,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
                 STREQ(val, "mouse")) {
                 virDomainInputDefPtr input;
                 if (VIR_ALLOC(input) < 0)
-                    goto no_memory;
+                    goto error;
                 input->bus = VIR_DOMAIN_INPUT_BUS_USB;
                 if (STREQ(val, "tablet"))
                     input->type = VIR_DOMAIN_INPUT_TYPE_TABLET;
@@ -10470,12 +10363,12 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
                     input->type = VIR_DOMAIN_INPUT_TYPE_MOUSE;
                 if (VIR_REALLOC_N(def->inputs, def->ninputs+1) < 0) {
                     virDomainInputDefFree(input);
-                    goto no_memory;
+                    goto error;
                 }
                 def->inputs[def->ninputs++] = input;
             } else if (STRPREFIX(val, "disk:")) {
                 if (VIR_ALLOC(disk) < 0)
-                    goto no_memory;
+                    goto error;
                 if (VIR_STRDUP(disk->src, val + strlen("disk:")) < 0)
                     goto error;
                 if (STRPREFIX(disk->src, "/dev/"))
@@ -10487,7 +10380,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
                 if (VIR_STRDUP(disk->dst, "sda") < 0)
                     goto error;
                 if (VIR_REALLOC_N(def->disks, def->ndisks+1) < 0)
-                    goto no_memory;
+                    goto error;
                 def->disks[def->ndisks++] = disk;
                 disk = NULL;
             } else {
@@ -10496,7 +10389,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
                     goto error;
                 if (VIR_REALLOC_N(def->hostdevs, def->nhostdevs+1) < 0) {
                     virDomainHostdevDefFree(hostdev);
-                    goto no_memory;
+                    goto error;
                 }
                 def->hostdevs[def->nhostdevs++] = hostdev;
             }
@@ -10508,7 +10401,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
                     goto error;
                 if (VIR_REALLOC_N(def->nets, def->nnets+1) < 0) {
                     virDomainNetDefFree(net);
-                    goto no_memory;
+                    goto error;
                 }
                 def->nets[def->nnets++] = net;
             }
@@ -10519,7 +10412,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
                                                   ceph_args != NULL)))
                 goto error;
             if (VIR_REALLOC_N(def->disks, def->ndisks+1) < 0)
-                goto no_memory;
+                goto error;
             if (disk->bus == VIR_DOMAIN_DISK_BUS_VIRTIO)
                 nvirtiodisk++;
 
@@ -10532,7 +10425,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
                 goto error;
             if (VIR_REALLOC_N(def->hostdevs, def->nhostdevs+1) < 0) {
                 virDomainHostdevDefFree(hostdev);
-                goto no_memory;
+                goto error;
             }
             def->hostdevs[def->nhostdevs++] = hostdev;
         } else if (STREQ(arg, "-soundhw")) {
@@ -10557,11 +10450,11 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
                 if (type != -1) {
                     virDomainSoundDefPtr snd;
                     if (VIR_ALLOC(snd) < 0)
-                        goto no_memory;
+                        goto error;
                     snd->model = type;
                     if (VIR_REALLOC_N(def->sounds, def->nsounds+1) < 0) {
                         VIR_FREE(snd);
-                        goto no_memory;
+                        goto error;
                     }
                     def->sounds[def->nsounds++] = snd;
                 }
@@ -10575,7 +10468,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
             if (model != -1) {
                 virDomainWatchdogDefPtr wd;
                 if (VIR_ALLOC(wd) < 0)
-                    goto no_memory;
+                    goto error;
                 wd->model = model;
                 wd->action = VIR_DOMAIN_WATCHDOG_ACTION_RESET;
                 def->watchdog = wd;
@@ -10614,7 +10507,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
         } else if (STREQ(arg, "-usb")) {
             virDomainControllerDefPtr ctldef;
             if (VIR_ALLOC(ctldef) < 0)
-                goto no_memory;
+                goto error;
             ctldef->type = VIR_DOMAIN_CONTROLLER_TYPE_USB;
             ctldef->idx = 0;
             ctldef->model = -1;
@@ -10633,7 +10526,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
                 virDomainChrSourceDefPtr chr;
 
                 if (VIR_ALLOC(chr) < 0)
-                    goto no_memory;
+                    goto error;
 
                 if (qemuParseCommandLineChr(chr, val) < 0) {
                     virDomainChrSourceDefFree(chr);
@@ -10683,7 +10576,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
             WANT_VALUE();
 
             if (VIR_ALLOC(def->nvram) < 0)
-                goto no_memory;
+                goto error;
 
             def->nvram->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO;
             def->nvram->info.addr.spaprvio.has_reg = true;
@@ -10704,7 +10597,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
             VIR_WARN("unknown QEMU argument '%s', adding to the qemu namespace",
                      arg);
             if (VIR_REALLOC_N(cmd->args, cmd->num_args+1) < 0)
-                goto no_memory;
+                goto error;
             if (VIR_STRDUP(cmd->args[cmd->num_args], arg) < 0)
                 goto error;
             cmd->num_args++;
@@ -10742,7 +10635,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
         while (token != NULL) {
             if (VIR_REALLOC_N(first_rbd_disk->hosts, first_rbd_disk->nhosts + 1) < 0) {
                 VIR_FREE(hosts);
-                goto no_memory;
+                goto error;
             }
             port = strchr(token, ':');
             if (port) {
@@ -10789,7 +10682,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
         const char *display = qemuFindEnv(progenv, "DISPLAY");
         const char *xauth = qemuFindEnv(progenv, "XAUTHORITY");
         if (VIR_ALLOC(sdl) < 0)
-            goto no_memory;
+            goto error;
         sdl->type = VIR_DOMAIN_GRAPHICS_TYPE_SDL;
         sdl->data.sdl.fullscreen = fullscreen;
         if (VIR_STRDUP(sdl->data.sdl.display, display) < 0) {
@@ -10803,7 +10696,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
 
         if (VIR_REALLOC_N(def->graphics, def->ngraphics+1) < 0) {
             virDomainGraphicsDefFree(sdl);
-            goto no_memory;
+            goto error;
         }
         def->graphics[def->ngraphics++] = sdl;
     }
@@ -10811,7 +10704,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
     if (def->ngraphics) {
         virDomainVideoDefPtr vid;
         if (VIR_ALLOC(vid) < 0)
-            goto no_memory;
+            goto error;
         if (def->virtType == VIR_DOMAIN_VIRT_XEN)
             vid->type = VIR_DOMAIN_VIDEO_TYPE_XEN;
         else
@@ -10823,7 +10716,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
 
         if (VIR_REALLOC_N(def->videos, def->nvideos+1) < 0) {
             virDomainVideoDefFree(vid);
-            goto no_memory;
+            goto error;
         }
         def->videos[def->nvideos++] = vid;
     }
@@ -10834,7 +10727,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
     if (!def->memballoon) {
         virDomainMemballoonDefPtr memballoon;
         if (VIR_ALLOC(memballoon) < 0)
-            goto no_memory;
+            goto error;
         memballoon->model = VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO;
 
         def->memballoon = memballoon;
@@ -10857,8 +10750,6 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
 
     return def;
 
-no_memory:
-    virReportOOMError();
 error:
     virDomainDiskDefFree(disk);
     VIR_FREE(cmd);
@@ -10918,20 +10809,16 @@ static int qemuParseProcFileStrings(int pid_value,
     char **str = NULL;
     int i;
 
-    if (virAsprintf(&path, "/proc/%d/%s", pid_value, name) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&path, "/proc/%d/%s", pid_value, name) < 0)
         goto cleanup;
-    }
 
     if ((len = virFileReadAll(path, 1024*128, &data)) < 0)
         goto cleanup;
 
     tmp = data;
     while (tmp < (data + len)) {
-        if (VIR_EXPAND_N(str, nstr, 1) < 0) {
-            virReportOOMError();
+        if (VIR_EXPAND_N(str, nstr, 1) < 0)
             goto cleanup;
-        }
 
         if (VIR_STRDUP(str[nstr-1], tmp) < 0)
             goto cleanup;
@@ -10941,10 +10828,8 @@ static int qemuParseProcFileStrings(int pid_value,
         tmp++;
     }
 
-    if (VIR_EXPAND_N(str, nstr, 1) < 0) {
-        virReportOOMError();
+    if (VIR_EXPAND_N(str, nstr, 1) < 0)
         goto cleanup;
-    }
 
     str[nstr-1] = NULL;
 
@@ -10987,10 +10872,8 @@ virDomainDefPtr qemuParseCommandLinePid(virCapsPtr qemuCaps,
                                      pidfile, monConfig, monJSON)))
         goto cleanup;
 
-    if (virAsprintf(&exepath, "/proc/%d/exe", (int) pid) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&exepath, "/proc/%d/exe", (int) pid) < 0)
         goto cleanup;
-    }
 
     if (virFileResolveLink(exepath, &emulator) < 0) {
         virReportSystemError(errno,
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 094f9f7..26aab5c 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -138,31 +138,31 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged)
     if (privileged) {
         if (virAsprintf(&cfg->logDir,
                         "%s/log/libvirt/qemu", LOCALSTATEDIR) < 0)
-            goto no_memory;
+            goto error;
 
         if (VIR_STRDUP(cfg->configBaseDir, SYSCONFDIR "/libvirt") < 0)
             goto error;
 
         if (virAsprintf(&cfg->stateDir,
                       "%s/run/libvirt/qemu", LOCALSTATEDIR) < 0)
-            goto no_memory;
+            goto error;
 
         if (virAsprintf(&cfg->libDir,
                       "%s/lib/libvirt/qemu", LOCALSTATEDIR) < 0)
-            goto no_memory;
+            goto error;
 
         if (virAsprintf(&cfg->cacheDir,
                       "%s/cache/libvirt/qemu", LOCALSTATEDIR) < 0)
-            goto no_memory;
+            goto error;
         if (virAsprintf(&cfg->saveDir,
                       "%s/lib/libvirt/qemu/save", LOCALSTATEDIR) < 0)
-            goto no_memory;
+            goto error;
         if (virAsprintf(&cfg->snapshotDir,
                         "%s/lib/libvirt/qemu/snapshot", LOCALSTATEDIR) < 0)
-            goto no_memory;
+            goto error;
         if (virAsprintf(&cfg->autoDumpPath,
                         "%s/lib/libvirt/qemu/dump", LOCALSTATEDIR) < 0)
-            goto no_memory;
+            goto error;
     } else {
         char *rundir;
         char *cachedir;
@@ -174,11 +174,11 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged)
         if (virAsprintf(&cfg->logDir,
                         "%s/qemu/log", cachedir) < 0) {
             VIR_FREE(cachedir);
-            goto no_memory;
+            goto error;
         }
         if (virAsprintf(&cfg->cacheDir, "%s/qemu/cache", cachedir) < 0) {
             VIR_FREE(cachedir);
-            goto no_memory;
+            goto error;
         }
         VIR_FREE(cachedir);
 
@@ -187,7 +187,7 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged)
             goto error;
         if (virAsprintf(&cfg->stateDir, "%s/qemu/run", rundir) < 0) {
             VIR_FREE(rundir);
-            goto no_memory;
+            goto error;
         }
         VIR_FREE(rundir);
 
@@ -195,19 +195,19 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged)
             goto error;
 
         if (virAsprintf(&cfg->libDir, "%s/qemu/lib", cfg->configBaseDir) < 0)
-            goto no_memory;
+            goto error;
         if (virAsprintf(&cfg->saveDir, "%s/qemu/save", cfg->configBaseDir) < 0)
-            goto no_memory;
+            goto error;
         if (virAsprintf(&cfg->snapshotDir, "%s/qemu/snapshot", cfg->configBaseDir) < 0)
-            goto no_memory;
+            goto error;
         if (virAsprintf(&cfg->autoDumpPath, "%s/qemu/dump", cfg->configBaseDir) < 0)
-            goto no_memory;
+            goto error;
     }
 
     if (virAsprintf(&cfg->configDir, "%s/qemu", cfg->configBaseDir) < 0)
-        goto no_memory;
+        goto error;
     if (virAsprintf(&cfg->autostartDir, "%s/qemu/autostart", cfg->configBaseDir) < 0)
-        goto no_memory;
+        goto error;
 
 
     if (VIR_STRDUP(cfg->vncListen, "127.0.0.1") < 0)
@@ -255,8 +255,6 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged)
 
     return cfg;
 
-no_memory:
-    virReportOOMError();
 error:
     virObjectUnref(cfg);
     return NULL;
@@ -377,7 +375,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
         }
 
         if (VIR_ALLOC_N(cfg->securityDriverNames, len + 1) < 0)
-            goto no_memory;
+            goto cleanup;
 
         for (i = 0, pp = p->list; pp; i++, pp = pp->next) {
             if (VIR_STRDUP(cfg->securityDriverNames[i], pp->str) < 0)
@@ -388,7 +386,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
         CHECK_TYPE("security_driver", VIR_CONF_STRING);
         if (p && p->str) {
             if (VIR_ALLOC_N(cfg->securityDriverNames, 2) < 0)
-                goto no_memory;
+                goto cleanup;
             if (VIR_STRDUP(cfg->securityDriverNames[0], p->str) < 0)
                 goto cleanup;
 
@@ -508,7 +506,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
         for (pp = p->list; pp; pp = pp->next)
             len++;
         if (VIR_ALLOC_N(cfg->cgroupDeviceACL, 1+len) < 0)
-            goto no_memory;
+            goto cleanup;
 
         for (i = 0, pp = p->list; pp; ++i, pp = pp->next) {
             if (pp->type != VIR_CONF_STRING) {
@@ -555,10 +553,6 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
 cleanup:
     virConfFree(conf);
     return ret;
-
-no_memory:
-    virReportOOMError();
-    goto cleanup;
 }
 #undef GET_VALUE_BOOL
 #undef GET_VALUE_LONG
@@ -594,7 +588,7 @@ virCapsPtr virQEMUDriverCreateCapabilities(virQEMUDriverPtr driver)
 
     /* Basic host arch / guest machine capabilities */
     if (!(caps = virQEMUCapsInit(driver->qemuCapsCache)))
-        goto no_memory;
+        goto error;
 
     if (virGetHostUUID(caps->host.host_uuid)) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -612,7 +606,7 @@ virCapsPtr virQEMUDriverCreateCapabilities(virQEMUDriverPtr driver)
     caps->host.nsecModels = i;
 
     if (VIR_ALLOC_N(caps->host.secModels, caps->host.nsecModels) < 0)
-        goto no_memory;
+        goto error;
 
     for (i = 0; sec_managers[i]; i++) {
         doi = virSecurityManagerGetDOI(sec_managers[i]);
@@ -628,8 +622,6 @@ virCapsPtr virQEMUDriverCreateCapabilities(virQEMUDriverPtr driver)
     virObjectUnref(cfg);
     return caps;
 
-no_memory:
-    virReportOOMError();
 error:
     VIR_FREE(sec_managers);
     virObjectUnref(caps);
@@ -740,10 +732,8 @@ virQEMUCloseCallbacksSet(virQEMUCloseCallbacksPtr closeCallbacks,
 
         closeDef->cb = cb;
     } else {
-        if (VIR_ALLOC(closeDef) < 0) {
-            virReportOOMError();
+        if (VIR_ALLOC(closeDef) < 0)
             goto cleanup;
-        }
 
         closeDef->conn = conn;
         closeDef->cb = cb;
@@ -878,10 +868,8 @@ virQEMUCloseCallbacksGetForConn(virQEMUCloseCallbacksPtr closeCallbacks,
     virQEMUCloseCallbacksListPtr list = NULL;
     struct virQEMUCloseCallbacksData data;
 
-    if (VIR_ALLOC(list) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC(list) < 0)
         return NULL;
-    }
 
     data.conn = conn;
     data.list = list;
@@ -965,10 +953,8 @@ qemuGetSharedDeviceKey(const char *device_path)
         return NULL;
     }
 
-    if (virAsprintf(&key, "%d:%d", maj, min) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&key, "%d:%d", maj, min) < 0)
         return NULL;
-    }
 
     return key;
 }
@@ -1013,10 +999,8 @@ qemuCheckSharedDevice(virHashTablePtr sharedDevices,
                                                      hostdev->source.subsys.u.scsi.unit)))
             goto cleanup;
 
-        if (virAsprintf(&hostdev_path, "/dev/%s", hostdev_name) < 0) {
-            virReportOOMError();
+        if (virAsprintf(&hostdev_path, "/dev/%s", hostdev_name) < 0)
             goto cleanup;
-        }
 
         device_path = hostdev_path;
     } else {
@@ -1127,15 +1111,11 @@ qemuSharedDeviceEntryCopy(const qemuSharedDeviceEntryPtr entry)
     qemuSharedDeviceEntryPtr ret = NULL;
     size_t i;
 
-    if (VIR_ALLOC(ret) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC(ret) < 0)
         return NULL;
-    }
 
-    if (VIR_ALLOC_N(ret->domains, entry->ref) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC_N(ret->domains, entry->ref) < 0)
         goto cleanup;
-    }
 
     for (i = 0; i < entry->ref; i++) {
         if (VIR_STRDUP(ret->domains[i], entry->domains[i]) < 0)
@@ -1212,10 +1192,8 @@ qemuAddSharedDevice(virQEMUDriverPtr driver,
                                                  hostdev->source.subsys.u.scsi.unit)))
             goto cleanup;
 
-        if (virAsprintf(&dev_path, "/dev/%s", dev_name) < 0) {
-            virReportOOMError();
+        if (virAsprintf(&dev_path, "/dev/%s", dev_name) < 0)
             goto cleanup;
-        }
 
         if (!(key = qemuGetSharedDeviceKey(dev_path)))
             goto cleanup;
@@ -1236,7 +1214,6 @@ qemuAddSharedDevice(virQEMUDriverPtr driver,
         if (VIR_EXPAND_N(new_entry->domains, new_entry->ref, 1) < 0 ||
             VIR_STRDUP(new_entry->domains[new_entry->ref - 1], name) < 0) {
             qemuSharedDeviceEntryFree(new_entry, NULL);
-            virReportOOMError();
             goto cleanup;
         }
 
@@ -1249,7 +1226,6 @@ qemuAddSharedDevice(virQEMUDriverPtr driver,
             VIR_ALLOC_N(entry->domains, 1) < 0 ||
             VIR_STRDUP(entry->domains[0], name) < 0) {
             qemuSharedDeviceEntryFree(entry, NULL);
-            virReportOOMError();
             goto cleanup;
         }
 
@@ -1325,10 +1301,8 @@ qemuRemoveSharedDevice(virQEMUDriverPtr driver,
                                                  hostdev->source.subsys.u.scsi.unit)))
             goto cleanup;
 
-        if (virAsprintf(&dev_path, "/dev/%s", dev_name) < 0) {
-            virReportOOMError();
+        if (virAsprintf(&dev_path, "/dev/%s", dev_name) < 0)
             goto cleanup;
-        }
 
         if (!(key = qemuGetSharedDeviceKey(dev_path)))
             goto cleanup;
@@ -1415,10 +1389,8 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
                                                      hostdev->source.subsys.u.scsi.unit)))
             goto cleanup;
 
-        if (virAsprintf(&hostdev_path, "/dev/%s", hostdev_name) < 0) {
-            virReportOOMError();
+        if (virAsprintf(&hostdev_path, "/dev/%s", hostdev_name) < 0)
             goto cleanup;
-        }
 
         path = hostdev_path;
     } else {
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 4db65fb..827bb38 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -348,10 +348,8 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data)
     xmlNodePtr *nodes = NULL;
     virQEMUCapsPtr qemuCaps = NULL;
 
-    if (VIR_ALLOC(priv->monConfig) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC(priv->monConfig) < 0)
         goto error;
-    }
 
     if (!(monitorpath =
           virXPathString("string(./monitor[1]/@path)", ctxt))) {
@@ -390,10 +388,8 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data)
         goto error;
     if (n) {
         priv->nvcpupids = n;
-        if (VIR_REALLOC_N(priv->vcpupids, priv->nvcpupids) < 0) {
-            virReportOOMError();
+        if (VIR_REALLOC_N(priv->vcpupids, priv->nvcpupids) < 0)
             goto error;
-        }
 
         for (i = 0; i < n; i++) {
             char *pidstr = virXMLPropString(nodes[i], "pid");
@@ -536,10 +532,8 @@ qemuDomainDefNamespaceParse(xmlDocPtr xml ATTRIBUTE_UNUSED,
         return -1;
     }
 
-    if (VIR_ALLOC(cmd) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC(cmd) < 0)
         return -1;
-    }
 
     /* first handle the extra command-line arguments */
     n = virXPathNodeSet("./qemu:commandline/qemu:arg", ctxt, &nodes);
@@ -548,7 +542,7 @@ qemuDomainDefNamespaceParse(xmlDocPtr xml ATTRIBUTE_UNUSED,
     uses_qemu_ns |= n > 0;
 
     if (n && VIR_ALLOC_N(cmd->args, n) < 0)
-        goto no_memory;
+        goto error;
 
     for (i = 0; i < n; i++) {
         cmd->args[cmd->num_args] = virXMLPropString(nodes[i], "value");
@@ -569,10 +563,10 @@ qemuDomainDefNamespaceParse(xmlDocPtr xml ATTRIBUTE_UNUSED,
     uses_qemu_ns |= n > 0;
 
     if (n && VIR_ALLOC_N(cmd->env_name, n) < 0)
-        goto no_memory;
+        goto error;
 
     if (n && VIR_ALLOC_N(cmd->env_value, n) < 0)
-        goto no_memory;
+        goto error;
 
     for (i = 0; i < n; i++) {
         char *tmp;
@@ -615,9 +609,6 @@ qemuDomainDefNamespaceParse(xmlDocPtr xml ATTRIBUTE_UNUSED,
 
     return 0;
 
-no_memory:
-    virReportOOMError();
-
 error:
     VIR_FREE(nodes);
     qemuDomainDefNamespaceFree(cmd);
@@ -800,10 +791,8 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
         if (virAsprintf(&dev->data.chr->source.data.nix.path,
                         "%s/channel/target/%s.%s",
                         cfg->libDir, def->name,
-                        dev->data.chr->target.name) < 0) {
-            virReportOOMError();
+                        dev->data.chr->target.name) < 0)
             goto cleanup;
-        }
         dev->data.chr->source.data.nix.listen = true;
     }
 
@@ -1393,7 +1382,6 @@ qemuDomainDefFormatBuf(virQEMUDriverPtr driver,
             ncontrollers = def->ncontrollers;
             if (VIR_ALLOC_N(def->controllers, ncontrollers - toremove) < 0) {
                 controllers = NULL;
-                virReportOOMError();
                 goto cleanup;
             }
 
@@ -1581,10 +1569,8 @@ qemuDomainOpenLogHelper(virQEMUDriverConfigPtr cfg,
     int fd = -1;
     bool trunc = false;
 
-    if (virAsprintf(&logfile, "%s/%s.log", cfg->logDir, vm->def->name) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&logfile, "%s/%s.log", cfg->logDir, vm->def->name) < 0)
         return -1;
-    }
 
     /* To make SELinux happy we always need to open in append mode.
      * So we fake O_TRUNC by calling ftruncate after open instead
@@ -1694,10 +1680,8 @@ int qemuDomainAppendLog(virQEMUDriverPtr driver,
         (fd = qemuDomainCreateLog(driver, obj, true)) < 0)
         goto cleanup;
 
-    if (virVasprintf(&message, fmt, argptr) < 0) {
-        virReportOOMError();
+    if (virVasprintf(&message, fmt, argptr) < 0)
         goto cleanup;
-    }
     if (safewrite(fd, message, strlen(message)) < 0) {
         virReportSystemError(errno, _("Unable to write to domain logfile %s"),
                              obj->def->name);
@@ -1744,20 +1728,16 @@ qemuDomainSnapshotWriteMetadata(virDomainObjPtr vm,
     if (newxml == NULL)
         return -1;
 
-    if (virAsprintf(&snapDir, "%s/%s", snapshotDir, vm->def->name) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&snapDir, "%s/%s", snapshotDir, vm->def->name) < 0)
         goto cleanup;
-    }
     if (virFileMakePath(snapDir) < 0) {
         virReportSystemError(errno, _("cannot create snapshot directory '%s'"),
                              snapDir);
         goto cleanup;
     }
 
-    if (virAsprintf(&snapFile, "%s/%s.xml", snapDir, snapshot->def->name) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&snapFile, "%s/%s.xml", snapDir, snapshot->def->name) < 0)
         goto cleanup;
-    }
 
     ret = virXMLSaveFile(snapFile, NULL, "snapshot-edit", newxml);
 
@@ -1889,10 +1869,8 @@ qemuDomainSnapshotDiscard(virQEMUDriverPtr driver,
     }
 
     if (virAsprintf(&snapFile, "%s/%s/%s.xml", cfg->snapshotDir,
-                    vm->def->name, snap->def->name) < 0) {
-        virReportOOMError();
+                    vm->def->name, snap->def->name) < 0)
         goto cleanup;
-    }
 
     if (snap == vm->current_snapshot) {
         if (update_current && snap->def->parent) {
@@ -2101,10 +2079,8 @@ qemuDomainCleanupAdd(virDomainObjPtr vm,
 
     if (VIR_RESIZE_N(priv->cleanupCallbacks,
                      priv->ncleanupCallbacks_max,
-                     priv->ncleanupCallbacks, 1) < 0) {
-        virReportOOMError();
+                     priv->ncleanupCallbacks, 1) < 0)
         return -1;
-    }
 
     priv->cleanupCallbacks[priv->ncleanupCallbacks++] = cb;
     return 0;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 1b9ba41..4af0811 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -600,7 +600,7 @@ qemuStateInitialize(bool privileged,
         goto error;
 
     if (virAsprintf(&driverConf, "%s/qemu.conf", cfg->configBaseDir) < 0)
-        goto out_of_memory;
+        goto error;
 
     if (virQEMUDriverConfigLoadFile(cfg, driverConf) < 0)
         goto error;
@@ -753,7 +753,7 @@ qemuStateInitialize(bool privileged,
         if (virAsprintf(&membase, "%s/libvirt",
                         cfg->hugetlbfsMount) < 0 ||
             virAsprintf(&mempath, "%s/qemu", membase) < 0)
-            goto out_of_memory;
+            goto error;
 
         if (virFileMakePath(mempath) < 0) {
             virReportSystemError(errno,
@@ -835,8 +835,6 @@ qemuStateInitialize(bool privileged,
     virNWFilterRegisterCallbackDriver(&qemuCallbackDriver);
     return 0;
 
-out_of_memory:
-    virReportOOMError();
 error:
     if (conn)
         virConnectClose(conn);
@@ -917,10 +915,8 @@ qemuStateStop(void) {
                                                VIR_CONNECT_LIST_DOMAINS_ACTIVE)) < 0)
         goto cleanup;
 
-    if (VIR_ALLOC_N(flags, numDomains) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC_N(flags, numDomains) < 0)
         goto cleanup;
-    }
 
     /* First we pause all VMs to make them stop dirtying
        pages, etc. We remember if any VMs were paused so
@@ -2825,10 +2821,8 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver,
     pad = 1024;
     pad += (QEMU_MONITOR_MIGRATE_TO_FILE_BS -
             ((offset + pad) % QEMU_MONITOR_MIGRATE_TO_FILE_BS));
-    if (VIR_ALLOC_N(xml, len + pad) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC_N(xml, len + pad) < 0)
         goto cleanup;
-    }
     strcpy(xml, domXML);
 
     offset += pad;
@@ -3112,7 +3106,6 @@ qemuDomainManagedSavePath(virQEMUDriverPtr driver, virDomainObjPtr vm)
     virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
 
     if (virAsprintf(&ret, "%s/%s.save", cfg->saveDir, vm->def->name) < 0) {
-        virReportOOMError();
         virObjectUnref(cfg);
         return NULL;
     }
@@ -3522,10 +3515,8 @@ qemuDomainScreenshot(virDomainPtr dom,
         goto endjob;
     }
 
-    if (virAsprintf(&tmp, "%s/qemu.screendump.XXXXXX", cfg->cacheDir) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&tmp, "%s/qemu.screendump.XXXXXX", cfg->cacheDir) < 0)
         goto endjob;
-    }
 
     if ((tmp_fd = mkostemp(tmp, O_CLOEXEC)) == -1) {
         virReportSystemError(errno, _("mkostemp(\"%s\") failed"), tmp);
@@ -3585,10 +3576,8 @@ static void processWatchdogEvent(virQEMUDriverPtr driver, virDomainObjPtr vm, in
             if (virAsprintf(&dumpfile, "%s/%s-%u",
                             cfg->autoDumpPath,
                             vm->def->name,
-                            (unsigned int)time(NULL)) < 0) {
-                virReportOOMError();
+                            (unsigned int)time(NULL)) < 0)
                 goto cleanup;
-            }
 
             if (qemuDomainObjBeginAsyncJob(driver, vm,
                                            QEMU_ASYNC_JOB_DUMP) < 0) {
@@ -3653,10 +3642,8 @@ doCoreDumpToAutoDumpPath(virQEMUDriverPtr driver,
     if (virAsprintf(&dumpfile, "%s/%s-%s",
                     cfg->autoDumpPath,
                     vm->def->name,
-                    timestr) < 0) {
-        virReportOOMError();
+                    timestr) < 0)
         goto cleanup;
-    }
 
     if (qemuDomainObjBeginAsyncJob(driver, vm,
                                    QEMU_ASYNC_JOB_DUMP) < 0) {
@@ -3916,15 +3903,11 @@ static int qemuDomainHotplugVcpus(virQEMUDriverPtr driver,
                 virDomainVcpuPinDefPtr vcpupin = NULL;
 
                 if (VIR_REALLOC_N(vm->def->cputune.vcpupin,
-                                  vm->def->cputune.nvcpupin + 1) < 0) {
-                    virReportOOMError();
+                                  vm->def->cputune.nvcpupin + 1) < 0)
                     goto cleanup;
-                }
 
-                if (VIR_ALLOC(vcpupin) < 0) {
-                    virReportOOMError();
+                if (VIR_ALLOC(vcpupin) < 0)
                     goto cleanup;
-                }
 
                 vcpupin->cpumask = virBitmapNew(VIR_DOMAIN_CPUMASK_LEN);
                 virBitmapCopy(vcpupin->cpumask, vm->def->cpumask);
@@ -4283,10 +4266,8 @@ qemuDomainPinVcpuFlags(virDomainPtr dom,
 
             newVcpuPinNum = vm->def->cputune.nvcpupin;
         } else {
-            if (VIR_ALLOC(newVcpuPin) < 0) {
-                virReportOOMError();
+            if (VIR_ALLOC(newVcpuPin) < 0)
                 goto cleanup;
-            }
             newVcpuPinNum = 0;
         }
 
@@ -4349,10 +4330,8 @@ qemuDomainPinVcpuFlags(virDomainPtr dom,
             }
         } else {
             if (!persistentDef->cputune.vcpupin) {
-                if (VIR_ALLOC(persistentDef->cputune.vcpupin) < 0) {
-                    virReportOOMError();
+                if (VIR_ALLOC(persistentDef->cputune.vcpupin) < 0)
                     goto cleanup;
-                }
                 persistentDef->cputune.nvcpupin = 0;
             }
             if (virDomainVcpuPinAdd(&persistentDef->cputune.vcpupin,
@@ -4549,10 +4528,8 @@ qemuDomainPinEmulator(virDomainPtr dom,
     if (flags & VIR_DOMAIN_AFFECT_LIVE) {
 
         if (priv->vcpupids != NULL) {
-            if (VIR_ALLOC(newVcpuPin) < 0) {
-                virReportOOMError();
+            if (VIR_ALLOC(newVcpuPin) < 0)
                 goto cleanup;
-            }
 
             if (virDomainVcpuPinAdd(&newVcpuPin, &newVcpuPinNum, cpumap, maplen, -1) < 0) {
                 virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -5002,7 +4979,6 @@ static int qemuDomainGetSecurityLabelList(virDomainPtr dom,
             len++;
 
         if (VIR_ALLOC_N((*seclabels), len) < 0) {
-            virReportOOMError();
             VIR_FREE(mgrs);
             goto cleanup;
         }
@@ -5170,10 +5146,8 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
         goto error;
     }
 
-    if (VIR_ALLOC_N(xml, header.xml_len) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC_N(xml, header.xml_len) < 0)
         goto error;
-    }
 
     if (saferead(fd, xml, header.xml_len) != header.xml_len) {
         virReportError(VIR_ERR_OPERATION_FAILED,
@@ -5500,10 +5474,8 @@ qemuDomainSaveImageDefineXML(virConnectPtr conn, const char *path,
                        _("new xml too large to fit in file"));
         goto cleanup;
     }
-    if (VIR_EXPAND_N(xml, len, header.xml_len - len) < 0) {
-        virReportOOMError();
+    if (VIR_EXPAND_N(xml, len, header.xml_len - len) < 0)
         goto cleanup;
-    }
 
     if (lseek(fd, 0, SEEK_SET) != 0) {
         virReportSystemError(errno, _("cannot seek in '%s'"), path);
@@ -6644,10 +6616,8 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps,
                            _("target %s already exists"), disk->dst);
             return -1;
         }
-        if (virDomainDiskInsert(vmdef, disk)) {
-            virReportOOMError();
+        if (virDomainDiskInsert(vmdef, disk))
             return -1;
-        }
         /* vmdef has the pointer. Generic codes for vmdef will do all jobs */
         dev->data.disk = NULL;
         if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO)
@@ -6659,10 +6629,8 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps,
 
     case VIR_DOMAIN_DEVICE_NET:
         net = dev->data.net;
-        if (virDomainNetInsert(vmdef, net)) {
-            virReportOOMError();
+        if (virDomainNetInsert(vmdef, net))
             return -1;
-        }
         dev->data.net = NULL;
         if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0)
             return -1;
@@ -6675,10 +6643,8 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps,
                            _("device is already in the domain configuration"));
             return -1;
         }
-        if (virDomainHostdevInsert(vmdef, hostdev)) {
-            virReportOOMError();
+        if (virDomainHostdevInsert(vmdef, hostdev))
             return -1;
-        }
         dev->data.hostdev = NULL;
         if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0)
             return -1;
@@ -7513,10 +7479,8 @@ qemuDomainParseDeviceWeightStr(char *deviceWeightStr,
 
     ndevices = (nsep + 1) / 2;
 
-    if (VIR_ALLOC_N(result, ndevices) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC_N(result, ndevices) < 0)
         return -1;
-    }
 
     i = 0;
     temp = deviceWeightStr;
@@ -7589,10 +7553,8 @@ qemuDomainMergeDeviceWeights(virBlkioDeviceWeightPtr *dest_array,
         if (!found) {
             if (!src->weight)
                 continue;
-            if (VIR_EXPAND_N(*dest_array, *dest_size, 1) < 0) {
-                virReportOOMError();
+            if (VIR_EXPAND_N(*dest_array, *dest_size, 1) < 0)
                 return -1;
-            }
             dest = &(*dest_array)[*dest_size - 1];
             dest->path = src->path;
             dest->weight = src->weight;
@@ -9053,10 +9015,8 @@ qemuDomainBlockResize(virDomainPtr dom,
     disk = vm->def->disks[i];
 
     if (virAsprintf(&device, "%s%s", QEMU_DRIVE_HOST_PREFIX,
-                    disk->info.alias) < 0) {
-        virReportOOMError();
+                    disk->info.alias) < 0)
         goto endjob;
-    }
 
     qemuDomainObjEnterMonitor(driver, vm);
     if (qemuMonitorBlockResize(priv->mon, device, size) < 0) {
@@ -9442,10 +9402,8 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
 
     if ((VIR_ALLOC(bandwidth) < 0) ||
         (VIR_ALLOC(bandwidth->in) < 0) ||
-        (VIR_ALLOC(bandwidth->out) < 0)) {
-        virReportOOMError();
+        (VIR_ALLOC(bandwidth->out) < 0))
         goto cleanup;
-    }
 
     for (i = 0; i < nparams; i++) {
         virTypedParameterPtr param = &params[i];
@@ -9476,20 +9434,16 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
     }
 
     if (flags & VIR_DOMAIN_AFFECT_LIVE) {
-        if (VIR_ALLOC(newBandwidth) < 0) {
-            virReportOOMError();
+        if (VIR_ALLOC(newBandwidth) < 0)
             goto cleanup;
-        }
 
         /* virNetDevBandwidthSet() will clear any previous value of
          * bandwidth parameters, so merge with old bandwidth parameters
          * here to prevent them from being lost. */
         if (bandwidth->in ||
             (net->bandwidth && net->bandwidth->in)) {
-            if (VIR_ALLOC(newBandwidth->in) < 0) {
-                virReportOOMError();
+            if (VIR_ALLOC(newBandwidth->in) < 0)
                 goto cleanup;
-            }
 
             memcpy(newBandwidth->in,
                    bandwidth->in ? bandwidth->in : net->bandwidth->in,
@@ -9497,10 +9451,8 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
         }
         if (bandwidth->out ||
             (net->bandwidth && net->bandwidth->out)) {
-            if (VIR_ALLOC(newBandwidth->out) < 0) {
-                virReportOOMError();
+            if (VIR_ALLOC(newBandwidth->out) < 0)
                 goto cleanup;
-            }
 
             memcpy(newBandwidth->out,
                    bandwidth->out ? bandwidth->out : net->bandwidth->out,
@@ -9821,10 +9773,8 @@ qemuDomainMemoryPeek(virDomainPtr dom,
         goto endjob;
     }
 
-    if (virAsprintf(&tmp, "%s/qemu.mem.XXXXXX", cfg->cacheDir) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&tmp, "%s/qemu.mem.XXXXXX", cfg->cacheDir) < 0)
         goto endjob;
-    }
 
     /* Create a temporary filename. */
     if ((fd = mkostemp(tmp, O_CLOEXEC)) == -1) {
@@ -11697,10 +11647,8 @@ qemuDomainSnapshotCreateInactiveExternal(virQEMUDriverPtr driver,
     if (!(qemuImgPath = qemuFindQemuImgBinary(driver)))
         goto cleanup;
 
-    if (!(created = virBitmapNew(snap->def->ndisks))) {
-        virReportOOMError();
+    if (!(created = virBitmapNew(snap->def->ndisks)))
         goto cleanup;
-    }
 
     /* If reuse is true, then qemuDomainSnapshotPrepare already
      * ensured that the new files exist, and it was up to the user to
@@ -12053,10 +12001,8 @@ qemuDomainSnapshotCreateSingleDiskActive(virQEMUDriverPtr driver,
 
     if (virAsprintf(&device, "drive-%s", disk->info.alias) < 0 ||
         VIR_STRDUP(source, snap->file) < 0 ||
-        (persistDisk && VIR_STRDUP(persistSource, source) < 0)) {
-        virReportOOMError();
+        (persistDisk && VIR_STRDUP(persistSource, source) < 0))
         goto cleanup;
-    }
 
     /* create the stub file and set selinux labels; manipulate disk in
      * place, in a way that can be reverted on failure. */
@@ -12180,10 +12126,8 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
     }
 
     if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION)) {
-        if (!(actions = virJSONValueNewArray())) {
-            virReportOOMError();
+        if (!(actions = virJSONValueNewArray()))
             goto cleanup;
-        }
     } else if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DISK_SNAPSHOT)) {
         virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                        _("live disk snapshot not supported with this "
@@ -13773,10 +13717,8 @@ static virDomainPtr qemuDomainQemuAttach(virConnectPtr conn,
     }
 
     if (!(def->name) &&
-        virAsprintf(&def->name, "attach-pid-%u", pid_value) < 0) {
-        virReportOOMError();
+        virAsprintf(&def->name, "attach-pid-%u", pid_value) < 0)
         goto cleanup;
-    }
 
     if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, def->emulator)))
         goto cleanup;
@@ -14001,10 +13943,8 @@ qemuDiskPathToAlias(virDomainObjPtr vm, const char *path, int *idx)
         *idx = i;
 
     if (disk->src) {
-        if (virAsprintf(&ret, "drive-%s", disk->info.alias) < 0) {
-            virReportOOMError();
+        if (virAsprintf(&ret, "drive-%s", disk->info.alias) < 0)
             return NULL;
-        }
     }
 
 cleanup:
@@ -15552,10 +15492,8 @@ qemuDomainGetPercpuStats(virDomainObjPtr vm,
         goto cleanup;
     }
 
-    if (VIR_ALLOC_N(sum_cpu_time, n) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC_N(sum_cpu_time, n) < 0)
         goto cleanup;
-    }
     if (getSumVcpuPercpuStats(vm, sum_cpu_time, n) < 0)
         goto cleanup;
 
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index a350059..cc8779d 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -277,10 +277,8 @@ int qemuDomainAttachVirtioDiskDevice(virConnectPtr conn,
             goto error;
     }
 
-    if (VIR_REALLOC_N(vm->def->disks, vm->def->ndisks+1) < 0) {
-        virReportOOMError();
+    if (VIR_REALLOC_N(vm->def->disks, vm->def->ndisks+1) < 0)
         goto error;
-    }
 
     qemuDomainObjEnterMonitor(driver, vm);
     if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
@@ -387,10 +385,8 @@ int qemuDomainAttachPciControllerDevice(virQEMUDriverPtr driver,
         }
     }
 
-    if (VIR_REALLOC_N(vm->def->controllers, vm->def->ncontrollers+1) < 0) {
-        virReportOOMError();
+    if (VIR_REALLOC_N(vm->def->controllers, vm->def->ncontrollers+1) < 0)
         goto cleanup;
-    }
 
     qemuDomainObjEnterMonitor(driver, vm);
     if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
@@ -440,10 +436,8 @@ qemuDomainFindOrCreateSCSIDiskController(virQEMUDriverPtr driver,
 
     /* No SCSI controller present, for backward compatibility we
      * now hotplug a controller */
-    if (VIR_ALLOC(cont) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC(cont) < 0)
         return NULL;
-    }
     cont->type = VIR_DOMAIN_CONTROLLER_TYPE_SCSI;
     cont->idx = controller;
     cont->model = -1;
@@ -534,10 +528,8 @@ int qemuDomainAttachSCSIDisk(virConnectPtr conn,
         goto error;
     }
 
-    if (VIR_REALLOC_N(vm->def->disks, vm->def->ndisks+1) < 0) {
-        virReportOOMError();
+    if (VIR_REALLOC_N(vm->def->disks, vm->def->ndisks+1) < 0)
         goto error;
-    }
 
     qemuDomainObjEnterMonitor(driver, vm);
     if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
@@ -638,10 +630,8 @@ int qemuDomainAttachUsbMassstorageDevice(virConnectPtr conn,
             goto error;
     }
 
-    if (VIR_REALLOC_N(vm->def->disks, vm->def->ndisks+1) < 0) {
-        virReportOOMError();
+    if (VIR_REALLOC_N(vm->def->disks, vm->def->ndisks+1) < 0)
         goto error;
-    }
 
     qemuDomainObjEnterMonitor(driver, vm);
     if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
@@ -711,10 +701,8 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
     int i;
 
     /* preallocate new slot for device */
-    if (VIR_REALLOC_N(vm->def->nets, vm->def->nnets+1) < 0) {
-        virReportOOMError();
+    if (VIR_REALLOC_N(vm->def->nets, vm->def->nnets+1) < 0)
         goto cleanup;
-    }
 
     /* If appropriate, grab a physical device from the configured
      * network's pool of devices, or resolve bridge device name
@@ -758,10 +746,8 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
         if (!tapfdSize)
             tapfdSize = vhostfdSize = 1;
         if (VIR_ALLOC_N(tapfd, tapfdSize) < 0 ||
-            VIR_ALLOC_N(vhostfd, vhostfdSize) < 0) {
-            virReportOOMError();
+            VIR_ALLOC_N(vhostfd, vhostfdSize) < 0)
             goto cleanup;
-        }
         if (qemuNetworkIfaceConnect(vm->def, conn, driver, net,
                                     priv->qemuCaps, tapfd, &tapfdSize) < 0)
             goto cleanup;
@@ -770,10 +756,8 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
             goto cleanup;
     } else if (actualType == VIR_DOMAIN_NET_TYPE_DIRECT) {
         tapfdSize = vhostfdSize = 1;
-        if (VIR_ALLOC(tapfd) < 0 || VIR_ALLOC(vhostfd) < 0) {
-            virReportOOMError();
+        if (VIR_ALLOC(tapfd) < 0 || VIR_ALLOC(vhostfd) < 0)
             goto cleanup;
-        }
         if ((tapfd[0] = qemuPhysIfaceConnect(vm->def, driver, net,
                                              priv->qemuCaps,
                                              VIR_NETDEV_VPORT_PROFILE_OP_CREATE)) < 0)
@@ -783,10 +767,8 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
             goto cleanup;
     } else if (actualType == VIR_DOMAIN_NET_TYPE_ETHERNET) {
         vhostfdSize = 1;
-        if (VIR_ALLOC(vhostfd) < 0) {
-            virReportOOMError();
+        if (VIR_ALLOC(vhostfd) < 0)
             goto cleanup;
-        }
         if (qemuOpenVhostNet(vm->def, net, priv->qemuCaps, vhostfd, &vhostfdSize) < 0)
             goto cleanup;
     }
@@ -826,19 +808,17 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
     }
 
     if (VIR_ALLOC_N(tapfdName, tapfdSize) < 0 ||
-        VIR_ALLOC_N(vhostfdName, vhostfdSize) < 0) {
-        virReportOOMError();
+        VIR_ALLOC_N(vhostfdName, vhostfdSize) < 0)
         goto cleanup;
-    }
 
     for (i = 0; i < tapfdSize; i++) {
         if (virAsprintf(&tapfdName[i], "fd-%s%d", net->info.alias, i) < 0)
-            goto no_memory;
+            goto cleanup;
     }
 
     for (i = 0; i < vhostfdSize; i++) {
         if (virAsprintf(&vhostfdName[i], "vhostfd-%s%d", net->info.alias, i) < 0)
-            goto no_memory;
+            goto cleanup;
     }
 
     if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV) &&
@@ -1003,7 +983,7 @@ try_remove:
             virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
             char *netdev_name;
             if (virAsprintf(&netdev_name, "host%s", net->info.alias) < 0)
-                goto no_memory;
+                goto cleanup;
             qemuDomainObjEnterMonitor(driver, vm);
             if (qemuMonitorRemoveNetdev(priv->mon, netdev_name) < 0)
                 VIR_WARN("Failed to remove network backend for netdev %s",
@@ -1016,7 +996,7 @@ try_remove:
     } else {
         char *hostnet_name;
         if (virAsprintf(&hostnet_name, "host%s", net->info.alias) < 0)
-            goto no_memory;
+            goto cleanup;
         qemuDomainObjEnterMonitor(driver, vm);
         if (qemuMonitorRemoveHostNetwork(priv->mon, vlan, hostnet_name) < 0)
             VIR_WARN("Failed to remove network backend for vlan %d, net %s",
@@ -1025,10 +1005,6 @@ try_remove:
         VIR_FREE(hostnet_name);
     }
     goto cleanup;
-
-no_memory:
-    virReportOOMError();
-    goto cleanup;
 }
 
 
@@ -1043,10 +1019,8 @@ int qemuDomainAttachHostPciDevice(virQEMUDriverPtr driver,
     char *configfd_name = NULL;
     bool releaseaddr = false;
 
-    if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs+1) < 0) {
-        virReportOOMError();
+    if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs+1) < 0)
         return -1;
-    }
 
     if (qemuPrepareHostdevPCIDevices(driver, vm->def->name, vm->def->uuid,
                                      &hostdev, 1) < 0)
@@ -1083,10 +1057,8 @@ int qemuDomainAttachHostPciDevice(virQEMUDriverPtr driver,
             configfd = qemuOpenPCIConfig(hostdev);
             if (configfd >= 0) {
                 if (virAsprintf(&configfd_name, "fd-%s",
-                                hostdev->info->alias) < 0) {
-                    virReportOOMError();
+                                hostdev->info->alias) < 0)
                     goto error;
-                }
             }
         }
 
@@ -1162,10 +1134,8 @@ int qemuDomainAttachRedirdevDevice(virQEMUDriverPtr driver,
             goto error;
     }
 
-    if (VIR_REALLOC_N(vm->def->redirdevs, vm->def->nredirdevs+1) < 0) {
-        virReportOOMError();
+    if (VIR_REALLOC_N(vm->def->redirdevs, vm->def->nredirdevs+1) < 0)
         goto error;
-    }
 
     qemuDomainObjEnterMonitor(driver, vm);
     if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE))
@@ -1223,10 +1193,8 @@ int qemuDomainAttachHostUsbDevice(virQEMUDriverPtr driver,
             goto cleanup;
     }
 
-    if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs+1) < 0) {
-        virReportOOMError();
+    if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs+1) < 0)
         goto cleanup;
-    }
 
     qemuDomainObjEnterMonitor(driver, vm);
     if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE))
@@ -1291,10 +1259,8 @@ qemuDomainAttachHostScsiDevice(virQEMUDriverPtr driver,
     if (!(devstr = qemuBuildSCSIHostdevDevStr(vm->def, hostdev, priv->qemuCaps)))
         goto cleanup;
 
-    if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs + 1) < 0) {
-        virReportOOMError();
+    if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs + 1) < 0)
         goto cleanup;
-    }
 
     qemuDomainObjEnterMonitor(driver, vm);
     if ((ret = qemuMonitorAddDrive(priv->mon, drvstr)) == 0) {
@@ -2208,10 +2174,8 @@ int qemuDomainDetachVirtioDiskDevice(virQEMUDriverPtr driver,
     /* build the actual drive id string as the disk->info.alias doesn't
      * contain the QEMU_DRIVE_HOST_PREFIX that is passed to qemu */
     if (virAsprintf(&drivestr, "%s%s",
-                    QEMU_DRIVE_HOST_PREFIX, detach->info.alias) < 0) {
-        virReportOOMError();
+                    QEMU_DRIVE_HOST_PREFIX, detach->info.alias) < 0)
         goto cleanup;
-    }
 
     qemuDomainObjEnterMonitor(driver, vm);
     if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
@@ -2307,10 +2271,8 @@ int qemuDomainDetachDiskDevice(virQEMUDriverPtr driver,
     /* build the actual drive id string as the disk->info.alias doesn't
      * contain the QEMU_DRIVE_HOST_PREFIX that is passed to qemu */
     if (virAsprintf(&drivestr, "%s%s",
-                    QEMU_DRIVE_HOST_PREFIX, detach->info.alias) < 0) {
-        virReportOOMError();
+                    QEMU_DRIVE_HOST_PREFIX, detach->info.alias) < 0)
         goto cleanup;
-    }
 
     qemuDomainObjEnterMonitor(driver, vm);
     if (qemuMonitorDelDevice(priv->mon, detach->info.alias) < 0) {
@@ -2829,10 +2791,8 @@ qemuDomainDetachNetDevice(virQEMUDriverPtr driver,
         goto cleanup;
     }
 
-    if (virAsprintf(&hostnet_name, "host%s", detach->info.alias) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&hostnet_name, "host%s", detach->info.alias) < 0)
         goto cleanup;
-    }
 
     qemuDomainObjEnterMonitor(driver, vm);
     if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index a6b7acb..f9fd64f 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -231,7 +231,7 @@ qemuDomainExtractTLSSubject(const char *certdir)
     size_t subjectlen;
 
     if (virAsprintf(&certfile, "%s/server-cert.pem", certdir) < 0)
-        goto no_memory;
+        goto error;
 
     if (virFileReadAll(certfile, 8192, &pemdata) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -260,7 +260,7 @@ qemuDomainExtractTLSSubject(const char *certdir)
 
     subjectlen = 1024;
     if (VIR_ALLOC_N(subject, subjectlen+1) < 0)
-        goto no_memory;
+        goto error;
 
     gnutls_x509_crt_get_dn(cert, subject, &subjectlen);
     subject[subjectlen] = '\0';
@@ -270,8 +270,6 @@ qemuDomainExtractTLSSubject(const char *certdir)
 
     return subject;
 
-no_memory:
-    virReportOOMError();
 error:
     VIR_FREE(certfile);
     VIR_FREE(pemdata);
@@ -288,7 +286,7 @@ qemuMigrationCookieGraphicsAlloc(virQEMUDriverPtr driver,
     virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
 
     if (VIR_ALLOC(mig) < 0)
-        goto no_memory;
+        goto error;
 
     mig->type = def->type;
     if (mig->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
@@ -324,8 +322,6 @@ qemuMigrationCookieGraphicsAlloc(virQEMUDriverPtr driver,
     virObjectUnref(cfg);
     return mig;
 
-no_memory:
-    virReportOOMError();
 error:
     qemuMigrationCookieGraphicsFree(mig);
     virObjectUnref(cfg);
@@ -341,12 +337,12 @@ qemuMigrationCookieNetworkAlloc(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
     int i;
 
     if (VIR_ALLOC(mig) < 0)
-        goto no_memory;
+        goto error;
 
     mig->nnets = def->nnets;
 
     if (VIR_ALLOC_N(mig->net, def->nnets) <0)
-        goto no_memory;
+        goto error;
 
     for (i = 0; i < def->nnets; i++) {
         virDomainNetDefPtr netptr;
@@ -379,8 +375,6 @@ qemuMigrationCookieNetworkAlloc(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
     }
     return mig;
 
-no_memory:
-    virReportOOMError();
 error:
     qemuMigrationCookieNetworkFree(mig);
     return NULL;
@@ -394,7 +388,7 @@ qemuMigrationCookieNew(virDomainObjPtr dom)
     const char *name;
 
     if (VIR_ALLOC(mig) < 0)
-        goto no_memory;
+        goto error;
 
     if (priv->origname)
         name = priv->origname;
@@ -414,8 +408,6 @@ qemuMigrationCookieNew(virDomainObjPtr dom)
 
     return mig;
 
-no_memory:
-    virReportOOMError();
 error:
     qemuMigrationCookieFree(mig);
     return NULL;
@@ -533,10 +525,8 @@ qemuMigrationCookieAddNBD(qemuMigrationCookiePtr mig,
 
     /* It is not a bug if there already is a NBD data */
     if (!mig->nbd &&
-        VIR_ALLOC(mig->nbd) < 0) {
-        virReportOOMError();
+        VIR_ALLOC(mig->nbd) < 0)
         return -1;
-    }
 
     mig->nbd->port = priv->nbdPort;
     mig->flags |= QEMU_MIGRATION_COOKIE_NBD;
@@ -686,7 +676,7 @@ qemuMigrationCookieGraphicsXMLParse(xmlXPathContextPtr ctxt)
     char *tmp;
 
     if (VIR_ALLOC(grap) < 0)
-        goto no_memory;
+        goto error;
 
     if (!(tmp = virXPathString("string(./graphics/@type)", ctxt))) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -722,8 +712,6 @@ qemuMigrationCookieGraphicsXMLParse(xmlXPathContextPtr ctxt)
 
     return grap;
 
-no_memory:
-    virReportOOMError();
 error:
     qemuMigrationCookieGraphicsFree(grap);
     return NULL;
@@ -741,7 +729,7 @@ qemuMigrationCookieNetworkXMLParse(xmlXPathContextPtr ctxt)
     xmlNodePtr save_ctxt = ctxt->node;
 
     if (VIR_ALLOC(optr) < 0)
-        goto no_memory;
+        goto error;
 
     if ((n = virXPathNodeSet("./network/interface", ctxt, &interfaces)) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -751,7 +739,7 @@ qemuMigrationCookieNetworkXMLParse(xmlXPathContextPtr ctxt)
 
     optr->nnets = n;
     if (VIR_ALLOC_N(optr->net, optr->nnets) < 0)
-        goto no_memory;
+        goto error;
 
     for (i = 0; i < n; i++) {
         /* portdata is optional, and may not exist */
@@ -772,8 +760,6 @@ cleanup:
     ctxt->node = save_ctxt;
     return optr;
 
-no_memory:
-    virReportOOMError();
 error:
     VIR_FREE(interfaces);
     qemuMigrationCookieNetworkFree(optr);
@@ -942,10 +928,8 @@ qemuMigrationCookieXMLParse(qemuMigrationCookiePtr mig,
         virXPathBoolean("boolean(./nbd)", ctxt)) {
         char *port;
 
-        if (VIR_ALLOC(mig->nbd) < 0) {
-            virReportOOMError();
+        if (VIR_ALLOC(mig->nbd) < 0)
             goto error;
-        }
 
         port = virXPathString("string(./nbd/@port)", ctxt);
         if (port && virStrToLong_i(port, NULL, 10, &mig->nbd->port) < 0) {
@@ -1131,10 +1115,8 @@ qemuMigrationStartNBDServer(virQEMUDriverPtr driver,
 
         VIR_FREE(diskAlias);
         if (virAsprintf(&diskAlias, "%s%s",
-                        QEMU_DRIVE_HOST_PREFIX, disk->info.alias) < 0) {
-            virReportOOMError();
+                        QEMU_DRIVE_HOST_PREFIX, disk->info.alias) < 0)
             goto cleanup;
-        }
 
         if (qemuDomainObjEnterMonitorAsync(driver, vm,
                                            QEMU_ASYNC_JOB_MIGRATION_IN) < 0)
@@ -1220,10 +1202,8 @@ qemuMigrationDriveMirror(virQEMUDriverPtr driver,
 
     /* escape literal IPv6 address */
     if (strchr(host, ':')) {
-        if (virAsprintf(&hoststr, "[%s]", host) < 0) {
-            virReportOOMError();
+        if (virAsprintf(&hoststr, "[%s]", host) < 0)
             goto error;
-        }
     } else if (VIR_STRDUP(hoststr, host) < 0) {
         goto error;
     }
@@ -1244,10 +1224,8 @@ qemuMigrationDriveMirror(virQEMUDriverPtr driver,
         if ((virAsprintf(&diskAlias, "%s%s",
                          QEMU_DRIVE_HOST_PREFIX, disk->info.alias) < 0) ||
             (virAsprintf(&nbd_dest, "nbd:%s:%d:exportname=%s",
-                         hoststr, port, diskAlias) < 0)) {
-            virReportOOMError();
+                         hoststr, port, diskAlias) < 0))
             goto error;
-        }
 
         if (qemuDomainObjEnterMonitorAsync(driver, vm,
                                            QEMU_ASYNC_JOB_MIGRATION_OUT) < 0)
@@ -1329,10 +1307,8 @@ error:
 
         VIR_FREE(diskAlias);
         if (virAsprintf(&diskAlias, "%s%s",
-                        QEMU_DRIVE_HOST_PREFIX, disk->info.alias) < 0) {
-            virReportOOMError();
+                        QEMU_DRIVE_HOST_PREFIX, disk->info.alias) < 0)
             continue;
-        }
         if (qemuDomainObjEnterMonitorAsync(driver, vm,
                                            QEMU_ASYNC_JOB_MIGRATION_OUT) == 0) {
             if (qemuMonitorBlockJob(priv->mon, diskAlias, NULL, 0,
@@ -1394,10 +1370,8 @@ qemuMigrationCancelDriveMirror(qemuMigrationCookiePtr mig,
 
         VIR_FREE(diskAlias);
         if (virAsprintf(&diskAlias, "%s%s",
-                        QEMU_DRIVE_HOST_PREFIX, disk->info.alias) < 0) {
-            virReportOOMError();
+                        QEMU_DRIVE_HOST_PREFIX, disk->info.alias) < 0)
             goto cleanup;
-        }
 
         if (qemuDomainObjEnterMonitorAsync(driver, vm,
                                            QEMU_ASYNC_JOB_MIGRATION_OUT) < 0)
@@ -2309,10 +2283,8 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
         /* QEMU will be started with -incoming [::]:port
          * or -incoming 0.0.0.0:port
          */
-        if (virAsprintf(&migrateFrom, "tcp:%s:%d", listenAddr, port) < 0) {
-            virReportOOMError();
+        if (virAsprintf(&migrateFrom, "tcp:%s:%d", listenAddr, port) < 0)
             goto cleanup;
-        }
     }
 
     if (!(vm = virDomainObjListAdd(driver->domains, *def,
@@ -2567,10 +2539,8 @@ qemuMigrationPrepareDirect(virQEMUDriverPtr driver,
          * new targets accept both syntaxes though.
          */
         /* Caller frees */
-        if (virAsprintf(uri_out, "tcp:%s:%d", hostname, this_port) < 0) {
-            virReportOOMError();
+        if (virAsprintf(uri_out, "tcp:%s:%d", hostname, this_port) < 0)
             goto cleanup;
-        }
     } else {
         /* Check the URI starts with "tcp:".  We will escape the
          * URI when passing it to the qemu monitor, so bad
@@ -2585,10 +2555,8 @@ qemuMigrationPrepareDirect(virQEMUDriverPtr driver,
 
         /* Convert uri_in to well-formed URI with // after tcp: */
         if (!(STRPREFIX(uri_in, "tcp://"))) {
-            if (virAsprintf(&uri_str, "tcp://%s", p) < 0) {
-                virReportOOMError();
+            if (virAsprintf(&uri_str, "tcp://%s", p) < 0)
                 goto cleanup;
-            }
         }
 
         uri = virURIParse(uri_str ? uri_str : uri_in);
@@ -2615,10 +2583,8 @@ qemuMigrationPrepareDirect(virQEMUDriverPtr driver,
                 port = 0;
 
             /* Caller frees */
-            if (virAsprintf(uri_out, "%s:%d", uri_in, this_port) < 0) {
-                virReportOOMError();
+            if (virAsprintf(uri_out, "%s:%d", uri_in, this_port) < 0)
                 goto cleanup;
-            }
 
         } else {
             this_port = uri->port;
@@ -2873,10 +2839,8 @@ static void qemuMigrationIOFunc(void *arg)
     VIR_DEBUG("Running migration tunnel; stream=%p, sock=%d",
               data->st, data->sock);
 
-    if (VIR_ALLOC_N(buffer, TUNNEL_SEND_BUF_SIZE) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC_N(buffer, TUNNEL_SEND_BUF_SIZE) < 0)
         goto abrt;
-    }
 
     fds[0].fd = data->sock;
     fds[1].fd = data->wakeupRecvFD;
@@ -2982,7 +2946,7 @@ qemuMigrationStartTunnel(virStreamPtr st,
     }
 
     if (VIR_ALLOC(io) < 0)
-        goto no_memory;
+        goto error;
 
     io->st = st;
     io->sock = sock;
@@ -2999,8 +2963,6 @@ qemuMigrationStartTunnel(virStreamPtr st,
 
     return io;
 
-no_memory:
-    virReportOOMError();
 error:
     VIR_FORCE_CLOSE(wakeupFD[0]);
     VIR_FORCE_CLOSE(wakeupFD[1]);
@@ -3053,10 +3015,8 @@ qemuMigrationConnect(virQEMUDriverPtr driver,
     int ret = -1;
 
     host = spec->dest.host.name;
-    if (virAsprintf(&port, "%d", spec->dest.host.port) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&port, "%d", spec->dest.host.port) < 0)
         return -1;
-    }
 
     spec->destType = MIGRATION_DEST_FD;
     spec->dest.fd.qemu = -1;
@@ -3355,10 +3315,8 @@ static int doNativeMigrate(virQEMUDriverPtr driver,
     if (STRPREFIX(uri, "tcp:") && !STRPREFIX(uri, "tcp://")) {
         char *tmp;
         /* HACK: source host generates bogus URIs, so fix them up */
-        if (virAsprintf(&tmp, "tcp://%s", uri + strlen("tcp:")) < 0) {
-            virReportOOMError();
+        if (virAsprintf(&tmp, "tcp://%s", uri + strlen("tcp:")) < 0)
             return -1;
-        }
         uribits = virURIParse(tmp);
         VIR_FREE(tmp);
     } else {
@@ -3450,10 +3408,8 @@ static int doTunnelMigrate(virQEMUDriverPtr driver,
 
         if (virAsprintf(&spec.dest.unix_socket.file,
                         "%s/qemu.tunnelmigrate.src.%s",
-                        cfg->libDir, vm->def->name) < 0) {
-            virReportOOMError();
+                        cfg->libDir, vm->def->name) < 0)
             goto cleanup;
-        }
 
         if (virNetSocketNewListenUNIX(spec.dest.unix_socket.file, 0700,
                                       cfg->user, cfg->group,
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index fe5ab0a..067b368 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -489,10 +489,8 @@ qemuMonitorIORead(qemuMonitorPtr mon)
 
     if (avail < 1024) {
         if (VIR_REALLOC_N(mon->buffer,
-                          mon->bufferLength + 1024) < 0) {
-            virReportOOMError();
+                          mon->bufferLength + 1024) < 0)
             return -1;
-        }
         mon->bufferLength += 1024;
         avail += 1024;
     }
@@ -864,10 +862,7 @@ char *qemuMonitorNextCommandID(qemuMonitorPtr mon)
 {
     char *id;
 
-    if (virAsprintf(&id, "libvirt-%d", ++mon->nextSerial) < 0) {
-        virReportOOMError();
-        return NULL;
-    }
+    ignore_value(virAsprintf(&id, "libvirt-%d", ++mon->nextSerial));
     return id;
 }
 
@@ -1962,10 +1957,8 @@ int qemuMonitorMigrateToHost(qemuMonitorPtr mon,
     }
 
 
-    if (virAsprintf(&uri, "tcp:%s:%d", hostname, port) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&uri, "tcp:%s:%d", hostname, port) < 0)
         return -1;
-    }
 
     if (mon->json)
         ret = qemuMonitorJSONMigrate(mon, flags, uri);
@@ -1994,15 +1987,11 @@ int qemuMonitorMigrateToCommand(qemuMonitorPtr mon,
     }
 
     argstr = virArgvToString(argv);
-    if (!argstr) {
-        virReportOOMError();
+    if (!argstr)
         goto cleanup;
-    }
 
-    if (virAsprintf(&dest, "exec:%s", argstr) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&dest, "exec:%s", argstr) < 0)
         goto cleanup;
-    }
 
     if (mon->json)
         ret = qemuMonitorJSONMigrate(mon, flags, dest);
@@ -2043,10 +2032,8 @@ int qemuMonitorMigrateToFile(qemuMonitorPtr mon,
     }
 
     argstr = virArgvToString(argv);
-    if (!argstr) {
-        virReportOOMError();
+    if (!argstr)
         goto cleanup;
-    }
 
     /* Migrate to file */
     virBufferEscapeShell(&buf, target);
@@ -2068,10 +2055,8 @@ int qemuMonitorMigrateToFile(qemuMonitorPtr mon,
                     offset / QEMU_MONITOR_MIGRATE_TO_FILE_BS,
                     QEMU_MONITOR_MIGRATE_TO_FILE_TRANSFER_SIZE,
                     QEMU_MONITOR_MIGRATE_TO_FILE_TRANSFER_SIZE,
-                    safe_target) < 0) {
-        virReportOOMError();
+                    safe_target) < 0)
         goto cleanup;
-    }
 
     if (mon->json)
         ret = qemuMonitorJSONMigrate(mon, flags, dest);
@@ -2100,10 +2085,8 @@ int qemuMonitorMigrateToUnix(qemuMonitorPtr mon,
         return -1;
     }
 
-    if (virAsprintf(&dest, "unix:%s", unixfile) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&dest, "unix:%s", unixfile) < 0)
         return -1;
-    }
 
     if (mon->json)
         ret = qemuMonitorJSONMigrate(mon, flags, dest);
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 3383c88..d326551 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -252,10 +252,8 @@ qemuMonitorJSONCommandWithFd(qemuMonitorPtr mon,
 
     if (!(cmdstr = virJSONValueToString(cmd, false)))
         goto cleanup;
-    if (virAsprintf(&msg.txBuffer, "%s\r\n", cmdstr) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&msg.txBuffer, "%s\r\n", cmdstr) < 0)
         goto cleanup;
-    }
     msg.txLength = strlen(msg.txBuffer);
     msg.txFD = scm_fd;
 
@@ -409,11 +407,11 @@ qemuMonitorJSONMakeCommandRaw(bool wrap, const char *cmdname, ...)
     va_start(args, cmdname);
 
     if (!(obj = virJSONValueNewObject()))
-        goto no_memory;
+        goto error;
 
     if (virJSONValueObjectAppendString(obj, wrap ? "type" : "execute",
                                        cmdname) < 0)
-        goto no_memory;
+        goto error;
 
     while ((key = va_arg(args, char *)) != NULL) {
         int ret;
@@ -432,7 +430,7 @@ qemuMonitorJSONMakeCommandRaw(bool wrap, const char *cmdname, ...)
 
         if (!jargs &&
             !(jargs = virJSONValueNewObject()))
-            goto no_memory;
+            goto error;
 
         /* This doesn't support maps, but no command uses those.  */
         switch (type) {
@@ -488,19 +486,17 @@ qemuMonitorJSONMakeCommandRaw(bool wrap, const char *cmdname, ...)
             goto error;
         }
         if (ret < 0)
-            goto no_memory;
+            goto error;
     }
 
     if (jargs &&
         virJSONValueObjectAppend(obj, wrap ? "data" : "arguments", jargs) < 0)
-        goto no_memory;
+        goto error;
 
     va_end(args);
 
     return obj;
 
-no_memory:
-    virReportOOMError();
 error:
     virJSONValueFree(obj);
     virJSONValueFree(jargs);
@@ -533,7 +529,7 @@ qemuMonitorJSONKeywordStringToJSON(const char *str, const char *firstkeyword)
     int i;
 
     if (!(ret = virJSONValueNewObject()))
-        goto no_memory;
+        goto error;
 
     nkeywords = qemuParseKeywords(str, &keywords, &values, 1);
 
@@ -550,19 +546,17 @@ qemuMonitorJSONKeywordStringToJSON(const char *str, const char *firstkeyword)
                 /* This 3rd arg isn't a typo - the way the parser works is
                  * that the value ended up in the keyword field */
                 if (virJSONValueObjectAppendString(ret, firstkeyword, keywords[i]) < 0)
-                    goto no_memory;
+                    goto error;
             }
         } else {
             if (virJSONValueObjectAppendString(ret, keywords[i], values[i]) < 0)
-                goto no_memory;
+                goto error;
         }
     }
 
     qemuFreeKeywords(nkeywords, keywords, values);
     return ret;
 
-no_memory:
-    virReportOOMError();
 error:
     qemuFreeKeywords(nkeywords, keywords, values);
     virJSONValueFree(ret);
@@ -1202,10 +1196,8 @@ qemuMonitorJSONExtractCPUInfo(virJSONValuePtr reply,
         goto cleanup;
     }
 
-    if (VIR_REALLOC_N(threads, ncpus) < 0) {
-        virReportOOMError();
+    if (VIR_REALLOC_N(threads, ncpus) < 0)
         goto cleanup;
-    }
 
     for (i = 0; i < ncpus; i++) {
         virJSONValuePtr entry = virJSONValueArrayGet(data, i);
@@ -1545,10 +1537,8 @@ int qemuMonitorJSONGetBlockInfo(qemuMonitorPtr mon,
         if (STRPREFIX(thisdev, QEMU_DRIVE_HOST_PREFIX))
             thisdev += strlen(QEMU_DRIVE_HOST_PREFIX);
 
-        if (VIR_ALLOC(info) < 0) {
-            virReportOOMError();
+        if (VIR_ALLOC(info) < 0)
             goto cleanup;
-        }
 
         if (virHashAddEntry(table, thisdev, info) < 0) {
             VIR_FREE(info);
@@ -2885,10 +2875,8 @@ int qemuMonitorJSONAddNetdev(qemuMonitorPtr mon,
     if (!args)
         goto cleanup;
 
-    if (virJSONValueObjectAppend(cmd, "arguments", args) < 0) {
-        virReportOOMError();
+    if (virJSONValueObjectAppend(cmd, "arguments", args) < 0)
         goto cleanup;
-    }
     args = NULL; /* obj owns reference to args now */
 
     ret = qemuMonitorJSONCommand(mon, cmd, &reply);
@@ -3082,10 +3070,8 @@ int qemuMonitorJSONAddDevice(qemuMonitorPtr mon,
     if (!args)
         goto cleanup;
 
-    if (virJSONValueObjectAppend(cmd, "arguments", args) < 0) {
-        virReportOOMError();
+    if (virJSONValueObjectAppend(cmd, "arguments", args) < 0)
         goto cleanup;
-    }
     args = NULL; /* obj owns reference to args now */
 
     ret = qemuMonitorJSONCommand(mon, cmd, &reply);
@@ -3139,10 +3125,8 @@ int qemuMonitorJSONSetDrivePassphrase(qemuMonitorPtr mon,
     virJSONValuePtr reply = NULL;
     char *drive;
 
-    if (virAsprintf(&drive, "%s%s", QEMU_DRIVE_HOST_PREFIX, alias) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&drive, "%s%s", QEMU_DRIVE_HOST_PREFIX, alias) < 0)
         return -1;
-    }
 
     cmd = qemuMonitorJSONMakeCommand("block_passwd",
                                      "s:device", drive,
@@ -3204,9 +3188,7 @@ qemuMonitorJSONDiskSnapshot(qemuMonitorPtr mon, virJSONValuePtr actions,
         return -1;
 
     if (actions) {
-        if (virJSONValueArrayAppend(actions, cmd) < 0) {
-            virReportOOMError();
-        } else {
+        if (virJSONValueArrayAppend(actions, cmd) == 0) {
             ret = 0;
             cmd = NULL;
         }
@@ -3412,7 +3394,7 @@ int qemuMonitorJSONSendKey(qemuMonitorPtr mon,
 
     /* create the key data array */
     if (!(keys = virJSONValueNewArray()))
-        goto no_memory;
+        goto cleanup;
 
     for (i = 0; i < nkeycodes; i++) {
         if (keycodes[i] > 0xffff) {
@@ -3423,18 +3405,18 @@ int qemuMonitorJSONSendKey(qemuMonitorPtr mon,
 
         /* create single key object */
         if (!(key = virJSONValueNewObject()))
-            goto no_memory;
+            goto cleanup;
 
         /* Union KeyValue has two types, use the generic one */
         if (virJSONValueObjectAppendString(key, "type", "number") < 0)
-            goto no_memory;
+            goto cleanup;
 
         /* with the keycode */
         if (virJSONValueObjectAppendNumberInt(key, "data", keycodes[i]) < 0)
-            goto no_memory;
+            goto cleanup;
 
         if (virJSONValueArrayAppend(keys, key) < 0)
-            goto no_memory;
+            goto cleanup;
 
         key = NULL;
 
@@ -3463,10 +3445,6 @@ cleanup:
     virJSONValueFree(keys);
     virJSONValueFree(key);
     return ret;
-
-no_memory:
-    virReportOOMError();
-    goto cleanup;
 }
 
 int qemuMonitorJSONScreendump(qemuMonitorPtr mon,
@@ -4007,20 +3985,16 @@ int qemuMonitorJSONGetMachines(qemuMonitorPtr mon,
     }
 
     /* null-terminated list */
-    if (VIR_ALLOC_N(infolist, n + 1) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC_N(infolist, n + 1) < 0)
         goto cleanup;
-    }
 
     for (i = 0; i < n; i++) {
         virJSONValuePtr child = virJSONValueArrayGet(data, i);
         const char *tmp;
         qemuMonitorMachineInfoPtr info;
 
-        if (VIR_ALLOC(info) < 0) {
-            virReportOOMError();
+        if (VIR_ALLOC(info) < 0)
             goto cleanup;
-        }
 
         infolist[i] = info;
 
@@ -4123,10 +4097,8 @@ int qemuMonitorJSONGetCPUDefinitions(qemuMonitorPtr mon,
     }
 
     /* null-terminated list */
-    if (VIR_ALLOC_N(cpulist, n + 1) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC_N(cpulist, n + 1) < 0)
         goto cleanup;
-    }
 
     for (i = 0; i < n; i++) {
         virJSONValuePtr child = virJSONValueArrayGet(data, i);
@@ -4193,10 +4165,8 @@ int qemuMonitorJSONGetCommands(qemuMonitorPtr mon,
     }
 
     /* null-terminated list */
-    if (VIR_ALLOC_N(commandlist, n + 1) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC_N(commandlist, n + 1) < 0)
         goto cleanup;
-    }
 
     for (i = 0; i < n; i++) {
         virJSONValuePtr child = virJSONValueArrayGet(data, i);
@@ -4268,10 +4238,8 @@ int qemuMonitorJSONGetEvents(qemuMonitorPtr mon,
     }
 
     /* null-terminated list */
-    if (VIR_ALLOC_N(eventlist, n + 1) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC_N(eventlist, n + 1) < 0)
         goto cleanup;
-    }
 
     for (i = 0; i < n; i++) {
         virJSONValuePtr child = virJSONValueArrayGet(data, i);
@@ -4382,10 +4350,8 @@ qemuMonitorJSONGetCommandLineOptionParameters(qemuMonitorPtr mon,
     }
 
     /* null-terminated list */
-    if (VIR_ALLOC_N(paramlist, n + 1) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC_N(paramlist, n + 1) < 0)
         goto cleanup;
-    }
 
     for (i = 0; i < n; i++) {
         virJSONValuePtr child = virJSONValueArrayGet(data, i);
@@ -4509,10 +4475,8 @@ int qemuMonitorJSONGetObjectTypes(qemuMonitorPtr mon,
     }
 
     /* null-terminated list */
-    if (VIR_ALLOC_N(typelist, n + 1) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC_N(typelist, n + 1) < 0)
         goto cleanup;
-    }
 
     for (i = 0; i < n; i++) {
         virJSONValuePtr child = virJSONValueArrayGet(data, i);
@@ -4587,10 +4551,8 @@ int qemuMonitorJSONGetObjectProps(qemuMonitorPtr mon,
     }
 
     /* null-terminated list */
-    if (VIR_ALLOC_N(proplist, n + 1) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC_N(proplist, n + 1) < 0)
         goto cleanup;
-    }
 
     for (i = 0; i < n; i++) {
         virJSONValuePtr child = virJSONValueArrayGet(data, i);
@@ -4740,18 +4702,18 @@ qemuMonitorJSONSetMigrationCapability(qemuMonitorPtr mon,
         goto cleanup;
 
     if (!(cap = virJSONValueNewObject()))
-        goto no_memory;
+        goto cleanup;
 
     if (virJSONValueObjectAppendString(
                 cap, "capability",
                 qemuMonitorMigrationCapsTypeToString(capability)) < 0)
-        goto no_memory;
+        goto cleanup;
 
     if (virJSONValueObjectAppendBoolean(cap, "state", 1) < 0)
-        goto no_memory;
+        goto cleanup;
 
     if (virJSONValueArrayAppend(caps, cap) < 0)
-        goto no_memory;
+        goto cleanup;
 
     cap = NULL;
 
@@ -4774,10 +4736,6 @@ cleanup:
     virJSONValueFree(cmd);
     virJSONValueFree(reply);
     return ret;
-
-no_memory:
-    virReportOOMError();
-    goto cleanup;
 }
 
 int
@@ -4794,19 +4752,15 @@ qemuMonitorJSONNBDServerStart(qemuMonitorPtr mon,
 
     if (!(data = virJSONValueNewObject()) ||
         !(addr = virJSONValueNewObject()) ||
-        (virAsprintf(&port_str, "%u", port) < 0)) {
-        virReportOOMError();
+        (virAsprintf(&port_str, "%u", port) < 0))
         goto cleanup;
-    }
 
     /* port is really expected as a string here by qemu */
     if (virJSONValueObjectAppendString(data, "host", host) < 0 ||
         virJSONValueObjectAppendString(data, "port", port_str) < 0 ||
         virJSONValueObjectAppendString(addr, "type", "inet") < 0 ||
-        virJSONValueObjectAppend(addr, "data", data) < 0) {
-        virReportOOMError();
+        virJSONValueObjectAppend(addr, "data", data) < 0)
         goto cleanup;
-    }
 
     /* From now on, @data is part of @addr */
     data = NULL;
@@ -4929,10 +4883,8 @@ qemuMonitorJSONGetStringArray(qemuMonitorPtr mon, const char *qmpCmd,
     }
 
     /* null-terminated list */
-    if (VIR_ALLOC_N(list, n + 1) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC_N(list, n + 1) < 0)
         goto cleanup;
-    }
 
     for (i = 0; i < n; i++) {
         virJSONValuePtr child = virJSONValueArrayGet(data, i);
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index 15fbcb7..9bc2b9e 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -190,10 +190,8 @@ int qemuMonitorTextIOProcess(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
              * BASIC_PROMPT we can reasonably reliably cope */
             if (want) {
                 if (VIR_REALLOC_N(msg->rxBuffer,
-                                  msg->rxLength + want + 1) < 0) {
-                    virReportOOMError();
+                                  msg->rxLength + want + 1) < 0)
                     return -1;
-                }
                 memcpy(msg->rxBuffer + msg->rxLength, start, want);
                 msg->rxLength += want;
                 msg->rxBuffer[msg->rxLength] = '\0';
@@ -233,10 +231,8 @@ qemuMonitorTextCommandWithHandler(qemuMonitorPtr mon,
 
     memset(&msg, 0, sizeof(msg));
 
-    if (virAsprintf(&msg.txBuffer, "%s\r", cmd) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&msg.txBuffer, "%s\r", cmd) < 0)
         return -1;
-    }
     msg.txLength = strlen(msg.txBuffer);
     msg.txFD = scm_fd;
     msg.passwordHandler = passwordHandler;
@@ -346,7 +342,6 @@ qemuMonitorSendDiskPassphrase(qemuMonitorPtr mon,
                       msg->txLength + passphrase_len + 1 + 1) < 0) {
         memset(passphrase, 0, passphrase_len);
         VIR_FREE(passphrase);
-        virReportOOMError();
         return -1;
     }
 
@@ -457,10 +452,8 @@ int qemuMonitorTextSetLink(qemuMonitorPtr mon, const char *name, enum virDomainN
     else
         st_str = "on";
 
-    if (virAsprintf(&cmd, "set_link %s %s", name, st_str) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&cmd, "set_link %s %s", name, st_str) < 0)
         goto error;
-    }
     if (qemuMonitorHMPCommand(mon, cmd, &info) < 0)
         goto error;
 
@@ -768,10 +761,8 @@ int qemuMonitorTextGetBlockInfo(qemuMonitorPtr mon,
         dev = p;
         p = strchr(p, ':');
         if (p && p < eol && *(p + 1) == ' ') {
-            if (VIR_ALLOC(info) < 0) {
-                virReportOOMError();
+            if (VIR_ALLOC(info) < 0)
                 goto cleanup;
-            }
 
             *p = '\0';
             p += 2;
@@ -1057,10 +1048,8 @@ int qemuMonitorTextBlockResize(qemuMonitorPtr mon,
     char *reply = NULL;
     int ret = -1;
 
-    if (virAsprintf(&cmd, "block_resize %s %lluB", device, size) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&cmd, "block_resize %s %lluB", device, size) < 0)
         goto cleanup;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
         goto cleanup;
@@ -1091,10 +1080,8 @@ qemuMonitorSendVNCPassphrase(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
     /* Enlarge transmit buffer to allow for the extra data
      * to be sent back */
     if (VIR_REALLOC_N(msg->txBuffer,
-                      msg->txLength + passphrase_len + 1 + 1) < 0) {
-        virReportOOMError();
+                      msg->txLength + passphrase_len + 1 + 1) < 0)
         return -1;
-    }
 
     /* Queue the password for sending */
     memcpy(msg->txBuffer + msg->txLength,
@@ -1135,10 +1122,8 @@ int qemuMonitorTextSetPassword(qemuMonitorPtr mon,
     int ret = -1;
 
     if (virAsprintf(&cmd, "set_password %s \"%s\" %s",
-                    protocol, password, action_if_connected) < 0) {
-        virReportOOMError();
+                    protocol, password, action_if_connected) < 0)
         goto cleanup;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
         goto cleanup;
@@ -1166,10 +1151,8 @@ int qemuMonitorTextExpirePassword(qemuMonitorPtr mon,
     int ret = -1;
 
     if (virAsprintf(&cmd, "expire_password %s %s",
-                    protocol, expire_time) < 0) {
-        virReportOOMError();
+                    protocol, expire_time) < 0)
         goto cleanup;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
         goto cleanup;
@@ -1202,10 +1185,8 @@ int qemuMonitorTextSetBalloon(qemuMonitorPtr mon,
      * 'newmem' is in KB, QEMU monitor works in MB, and we all wish
      * we just worked in bytes with unsigned long long everywhere.
      */
-    if (virAsprintf(&cmd, "balloon %lu", VIR_DIV_UP(newmem, 1024)) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&cmd, "balloon %lu", VIR_DIV_UP(newmem, 1024)) < 0)
         return -1;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
         VIR_FREE(cmd);
@@ -1237,10 +1218,8 @@ int qemuMonitorTextSetCPU(qemuMonitorPtr mon, int cpu, bool online)
     char *reply = NULL;
     int ret = -1;
 
-    if (virAsprintf(&cmd, "cpu_set %d %s", cpu, online ? "online" : "offline") < 0) {
-        virReportOOMError();
+    if (virAsprintf(&cmd, "cpu_set %d %s", cpu, online ? "online" : "offline") < 0)
         return -1;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
         VIR_FREE(cmd);
@@ -1270,10 +1249,8 @@ int qemuMonitorTextEjectMedia(qemuMonitorPtr mon,
     char *reply = NULL;
     int ret = -1;
 
-    if (virAsprintf(&cmd, "eject %s%s", force ? "-f " : "", dev_name) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&cmd, "eject %s%s", force ? "-f " : "", dev_name) < 0)
         goto cleanup;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
         goto cleanup;
@@ -1306,15 +1283,11 @@ int qemuMonitorTextChangeMedia(qemuMonitorPtr mon,
     char *safepath = NULL;
     int ret = -1;
 
-    if (!(safepath = qemuMonitorEscapeArg(newmedia))) {
-        virReportOOMError();
+    if (!(safepath = qemuMonitorEscapeArg(newmedia)))
         goto cleanup;
-    }
 
-    if (virAsprintf(&cmd, "change %s \"%s\"", dev_name, safepath) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&cmd, "change %s \"%s\"", dev_name, safepath) < 0)
         goto cleanup;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
         goto cleanup;
@@ -1355,15 +1328,11 @@ static int qemuMonitorTextSaveMemory(qemuMonitorPtr mon,
     char *safepath = NULL;
     int ret = -1;
 
-    if (!(safepath = qemuMonitorEscapeArg(path))) {
-        virReportOOMError();
+    if (!(safepath = qemuMonitorEscapeArg(path)))
         goto cleanup;
-    }
 
-    if (virAsprintf(&cmd, "%s %llu %zi \"%s\"", cmdtype, offset, length, safepath) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&cmd, "%s %llu %zi \"%s\"", cmdtype, offset, length, safepath) < 0)
         goto cleanup;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
         goto cleanup;
@@ -1404,10 +1373,8 @@ int qemuMonitorTextSetMigrationSpeed(qemuMonitorPtr mon,
     char *info = NULL;
     int ret = -1;
 
-    if (virAsprintf(&cmd, "migrate_set_speed %lum", bandwidth) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&cmd, "migrate_set_speed %lum", bandwidth) < 0)
         goto cleanup;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &info) < 0)
         goto cleanup;
@@ -1428,10 +1395,8 @@ int qemuMonitorTextSetMigrationDowntime(qemuMonitorPtr mon,
     char *info = NULL;
     int ret = -1;
 
-    if (virAsprintf(&cmd, "migrate_set_downtime %llums", downtime) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&cmd, "migrate_set_downtime %llums", downtime) < 0)
         goto cleanup;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &info) < 0)
         goto cleanup;
@@ -1592,10 +1557,8 @@ int qemuMonitorTextMigrate(qemuMonitorPtr mon,
     virBuffer extra = VIR_BUFFER_INITIALIZER;
     char *extrastr = NULL;
 
-    if (!safedest) {
-        virReportOOMError();
+    if (!safedest)
         return -1;
-    }
 
     if (flags & QEMU_MONITOR_MIGRATE_BACKGROUND)
         virBufferAddLit(&extra, " -d");
@@ -1611,10 +1574,8 @@ int qemuMonitorTextMigrate(qemuMonitorPtr mon,
 
     extrastr = virBufferContentAndReset(&extra);
     if (virAsprintf(&cmd, "migrate %s\"%s\"", extrastr ? extrastr : "",
-                    safedest) < 0) {
-        virReportOOMError();
+                    safedest) < 0)
         goto cleanup;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &info) < 0)
         goto cleanup;
@@ -1668,10 +1629,8 @@ int qemuMonitorTextGraphicsRelocate(qemuMonitorPtr mon,
 
     if (virAsprintf(&cmd, "client_migrate_info %s %s %d %d %s",
                     type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE ? "spice" : "vnc",
-                    hostname, port, tlsPort, tlsSubject ? tlsSubject : "") < 0) {
-        virReportOOMError();
+                    hostname, port, tlsPort, tlsSubject ? tlsSubject : "") < 0)
         return -1;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &info) < 0) {
         VIR_FREE(cmd);
@@ -1693,15 +1652,11 @@ int qemuMonitorTextAddUSBDisk(qemuMonitorPtr mon,
     char *info = NULL;
 
     safepath = qemuMonitorEscapeArg(path);
-    if (!safepath) {
-        virReportOOMError();
+    if (!safepath)
         return -1;
-    }
 
-    if (virAsprintf(&cmd, "usb_add disk:%s", safepath) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&cmd, "usb_add disk:%s", safepath) < 0)
         goto cleanup;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &info) < 0)
         goto cleanup;
@@ -1731,10 +1686,8 @@ static int qemuMonitorTextAddUSBDevice(qemuMonitorPtr mon,
     char *reply = NULL;
     int ret = -1;
 
-    if (virAsprintf(&cmd, "usb_add %s", addr) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&cmd, "usb_add %s", addr) < 0)
         return -1;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
         goto cleanup;
@@ -1763,10 +1716,8 @@ int qemuMonitorTextAddUSBDeviceExact(qemuMonitorPtr mon,
     int ret;
     char *addr;
 
-    if (virAsprintf(&addr, "host:%.3d.%.3d", bus, dev) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&addr, "host:%.3d.%.3d", bus, dev) < 0)
         return -1;
-    }
 
     ret = qemuMonitorTextAddUSBDevice(mon, addr);
 
@@ -1781,10 +1732,8 @@ int qemuMonitorTextAddUSBDeviceMatch(qemuMonitorPtr mon,
     int ret;
     char *addr;
 
-    if (virAsprintf(&addr, "host:%.4x:%.4x", vendor, product) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&addr, "host:%.4x:%.4x", vendor, product) < 0)
         return -1;
-    }
 
     ret = qemuMonitorTextAddUSBDevice(mon, addr);
 
@@ -1869,10 +1818,8 @@ int qemuMonitorTextAddPCIHostDevice(qemuMonitorPtr mon,
 
     /* XXX hostAddr->domain */
     if (virAsprintf(&cmd, "pci_add pci_addr=auto host host=%.2x:%.2x.%.1x",
-                    hostAddr->bus, hostAddr->slot, hostAddr->function) < 0) {
-        virReportOOMError();
+                    hostAddr->bus, hostAddr->slot, hostAddr->function) < 0)
         goto cleanup;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
         goto cleanup;
@@ -1910,17 +1857,13 @@ int qemuMonitorTextAddPCIDisk(qemuMonitorPtr mon,
     int ret = -1;
 
     safe_path = qemuMonitorEscapeArg(path);
-    if (!safe_path) {
-        virReportOOMError();
+    if (!safe_path)
         return -1;
-    }
 
 try_command:
     if (virAsprintf(&cmd, "pci_add %s storage file=%s,if=%s",
-                    (tryOldSyntax ? "0": "pci_addr=auto"), safe_path, bus) < 0) {
-        virReportOOMError();
+                    (tryOldSyntax ? "0": "pci_addr=auto"), safe_path, bus) < 0)
         goto cleanup;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
         goto cleanup;
@@ -1956,10 +1899,8 @@ int qemuMonitorTextAddPCINetwork(qemuMonitorPtr mon,
     char *reply = NULL;
     int ret = -1;
 
-    if (virAsprintf(&cmd, "pci_add pci_addr=auto nic %s", nicstr) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&cmd, "pci_add pci_addr=auto nic %s", nicstr) < 0)
         return -1;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
         goto cleanup;
@@ -1989,17 +1930,13 @@ int qemuMonitorTextRemovePCIDevice(qemuMonitorPtr mon,
 
 try_command:
     if (tryOldSyntax) {
-        if (virAsprintf(&cmd, "pci_del 0 %.2x", guestAddr->slot) < 0) {
-            virReportOOMError();
+        if (virAsprintf(&cmd, "pci_del 0 %.2x", guestAddr->slot) < 0)
             goto cleanup;
-        }
     } else {
         /* XXX function ? */
         if (virAsprintf(&cmd, "pci_del pci_addr=%.4x:%.2x:%.2x",
-                        guestAddr->domain, guestAddr->bus, guestAddr->slot) < 0) {
-            virReportOOMError();
+                        guestAddr->domain, guestAddr->bus, guestAddr->slot) < 0)
             goto cleanup;
-        }
     }
 
     if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
@@ -2042,10 +1979,8 @@ int qemuMonitorTextSendFileHandle(qemuMonitorPtr mon,
     char *reply = NULL;
     int ret = -1;
 
-    if (virAsprintf(&cmd, "getfd %s", fdname) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&cmd, "getfd %s", fdname) < 0)
         return -1;
-    }
 
     if (qemuMonitorHMPCommandWithFd(mon, cmd, fd, &reply) < 0)
         goto cleanup;
@@ -2082,10 +2017,8 @@ int qemuMonitorTextCloseFileHandle(qemuMonitorPtr mon,
     char *reply = NULL;
     int ret = -1;
 
-    if (virAsprintf(&cmd, "closefd %s", fdname) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&cmd, "closefd %s", fdname) < 0)
         return -1;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
         goto cleanup;
@@ -2115,10 +2048,8 @@ int qemuMonitorTextAddHostNetwork(qemuMonitorPtr mon,
     char *reply = NULL;
     int ret = -1;
 
-    if (virAsprintf(&cmd, "host_net_add %s", netstr) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&cmd, "host_net_add %s", netstr) < 0)
         return -1;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
         goto cleanup;
@@ -2147,10 +2078,8 @@ int qemuMonitorTextRemoveHostNetwork(qemuMonitorPtr mon,
     char *reply = NULL;
     int ret = -1;
 
-    if (virAsprintf(&cmd, "host_net_remove %d %s", vlan, netname) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&cmd, "host_net_remove %d %s", vlan, netname) < 0)
         return -1;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
         goto cleanup;
@@ -2173,10 +2102,8 @@ int qemuMonitorTextAddNetdev(qemuMonitorPtr mon,
     char *reply = NULL;
     int ret = -1;
 
-    if (virAsprintf(&cmd, "netdev_add %s", netdevstr) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&cmd, "netdev_add %s", netdevstr) < 0)
         return -1;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
         goto cleanup;
@@ -2199,10 +2126,8 @@ int qemuMonitorTextRemoveNetdev(qemuMonitorPtr mon,
     char *reply = NULL;
     int ret = -1;
 
-    if (virAsprintf(&cmd, "netdev_del %s", alias) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&cmd, "netdev_del %s", alias) < 0)
         return -1;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
         goto cleanup;
@@ -2311,10 +2236,8 @@ int qemuMonitorTextAttachPCIDiskController(qemuMonitorPtr mon,
 
 try_command:
     if (virAsprintf(&cmd, "pci_add %s storage if=%s",
-                    (tryOldSyntax ? "0": "pci_addr=auto"), bus) < 0) {
-        virReportOOMError();
+                    (tryOldSyntax ? "0": "pci_addr=auto"), bus) < 0)
         goto cleanup;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
         goto cleanup;
@@ -2398,19 +2321,15 @@ int qemuMonitorTextAttachDrive(qemuMonitorPtr mon,
     bool tryOldSyntax = false;
 
     safe_str = qemuMonitorEscapeArg(drivestr);
-    if (!safe_str) {
-        virReportOOMError();
+    if (!safe_str)
         return -1;
-    }
 
 try_command:
     if (virAsprintf(&cmd, "drive_add %s%.2x:%.2x:%.2x %s",
                     (tryOldSyntax ? "" : "pci_addr="),
                     controllerAddr->domain, controllerAddr->bus,
-                    controllerAddr->slot, safe_str) < 0) {
-        virReportOOMError();
+                    controllerAddr->slot, safe_str) < 0)
         goto cleanup;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
         goto cleanup;
@@ -2538,10 +2457,8 @@ int qemuMonitorTextGetAllPCIAddresses(qemuMonitorPtr mon,
         p++;
         GET_INT(p, 16, product);
 
-        if (VIR_REALLOC_N(addrs, naddrs+1) < 0) {
-            virReportOOMError();
+        if (VIR_REALLOC_N(addrs, naddrs+1) < 0)
             goto error;
-        }
 
         addrs[naddrs].addr.domain = 0;
         addrs[naddrs].addr.bus = bus;
@@ -2579,15 +2496,11 @@ int qemuMonitorTextDelDevice(qemuMonitorPtr mon,
     char *safedev;
     int ret = -1;
 
-    if (!(safedev = qemuMonitorEscapeArg(devalias))) {
-        virReportOOMError();
+    if (!(safedev = qemuMonitorEscapeArg(devalias)))
         goto cleanup;
-    }
 
-    if (virAsprintf(&cmd, "device_del %s", safedev) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&cmd, "device_del %s", safedev) < 0)
         goto cleanup;
-    }
 
     VIR_DEBUG("TextDelDevice devalias=%s", devalias);
     if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
@@ -2617,15 +2530,11 @@ int qemuMonitorTextAddDevice(qemuMonitorPtr mon,
     char *safedev;
     int ret = -1;
 
-    if (!(safedev = qemuMonitorEscapeArg(devicestr))) {
-        virReportOOMError();
+    if (!(safedev = qemuMonitorEscapeArg(devicestr)))
         goto cleanup;
-    }
 
-    if (virAsprintf(&cmd, "device_add %s", safedev) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&cmd, "device_add %s", safedev) < 0)
         goto cleanup;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
         goto cleanup;
@@ -2665,17 +2574,13 @@ int qemuMonitorTextAddDrive(qemuMonitorPtr mon,
     char *safe_str;
 
     safe_str = qemuMonitorEscapeArg(drivestr);
-    if (!safe_str) {
-        virReportOOMError();
+    if (!safe_str)
         return -1;
-    }
 
     /* 'dummy' here is just a placeholder since there is no PCI
      * address required when attaching drives to a controller */
-    if (virAsprintf(&cmd, "drive_add dummy %s", safe_str) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&cmd, "drive_add dummy %s", safe_str) < 0)
         goto cleanup;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
         goto cleanup;
@@ -2712,15 +2617,11 @@ int qemuMonitorTextDriveDel(qemuMonitorPtr mon,
     int ret = -1;
     VIR_DEBUG("TextDriveDel drivestr=%s", drivestr);
 
-    if (!(safedev = qemuMonitorEscapeArg(drivestr))) {
-        virReportOOMError();
+    if (!(safedev = qemuMonitorEscapeArg(drivestr)))
         goto cleanup;
-    }
 
-    if (virAsprintf(&cmd, "drive_del %s", safedev) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&cmd, "drive_del %s", safedev) < 0)
         goto cleanup;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
         goto cleanup;
@@ -2761,16 +2662,12 @@ int qemuMonitorTextSetDrivePassphrase(qemuMonitorPtr mon,
     char *safe_str;
 
     safe_str = qemuMonitorEscapeArg(passphrase);
-    if (!safe_str) {
-        virReportOOMError();
+    if (!safe_str)
         return -1;
-    }
 
     if (virAsprintf(&cmd, "block_passwd %s%s \"%s\"",
-                    QEMU_DRIVE_HOST_PREFIX, alias, safe_str) < 0) {
-        virReportOOMError();
+                    QEMU_DRIVE_HOST_PREFIX, alias, safe_str) < 0)
         goto cleanup;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
         goto cleanup;
@@ -2802,10 +2699,8 @@ int qemuMonitorTextCreateSnapshot(qemuMonitorPtr mon, const char *name)
     char *safename;
 
     if (!(safename = qemuMonitorEscapeArg(name)) ||
-        virAsprintf(&cmd, "savevm \"%s\"", safename) < 0) {
-        virReportOOMError();
+        virAsprintf(&cmd, "savevm \"%s\"", safename) < 0)
         goto cleanup;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &reply))
         goto cleanup;
@@ -2847,10 +2742,8 @@ int qemuMonitorTextLoadSnapshot(qemuMonitorPtr mon, const char *name)
     char *safename;
 
     if (!(safename = qemuMonitorEscapeArg(name)) ||
-        virAsprintf(&cmd, "loadvm \"%s\"", safename) < 0) {
-        virReportOOMError();
+        virAsprintf(&cmd, "loadvm \"%s\"", safename) < 0)
         goto cleanup;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &reply))
         goto cleanup;
@@ -2902,10 +2795,8 @@ int qemuMonitorTextDeleteSnapshot(qemuMonitorPtr mon, const char *name)
     char *safename;
 
     if (!(safename = qemuMonitorEscapeArg(name)) ||
-        virAsprintf(&cmd, "delvm \"%s\"", safename) < 0) {
-        virReportOOMError();
+        virAsprintf(&cmd, "delvm \"%s\"", safename) < 0)
         goto cleanup;
-    }
     if (qemuMonitorHMPCommand(mon, cmd, &reply))
         goto cleanup;
 
@@ -2940,10 +2831,8 @@ int qemuMonitorTextArbitraryCommand(qemuMonitorPtr mon, const char *cmd,
     char *safecmd = NULL;
     int ret;
 
-    if (!(safecmd = qemuMonitorEscapeArg(cmd))) {
-        virReportOOMError();
+    if (!(safecmd = qemuMonitorEscapeArg(cmd)))
         return -1;
-    }
 
     ret = qemuMonitorHMPCommand(mon, safecmd, reply);
 
@@ -3032,10 +2921,8 @@ int qemuMonitorTextScreendump(qemuMonitorPtr mon, const char *file)
     char *reply = NULL;
     int ret = -1;
 
-    if (virAsprintf(&cmd, "screendump %s", file) < 0){
-        virReportOOMError();
+    if (virAsprintf(&cmd, "screendump %s", file) < 0)
         goto cleanup;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
         goto cleanup;
@@ -3063,10 +2950,8 @@ int qemuMonitorTextOpenGraphics(qemuMonitorPtr mon,
     char *reply = NULL;
     int ret = -1;
 
-    if (virAsprintf(&cmd, "add_client %s %s %d", protocol, fdname, skipauth ? 0 : 1) < 0){
-        virReportOOMError();
+    if (virAsprintf(&cmd, "add_client %s %s %d", protocol, fdname, skipauth ? 0 : 1) < 0)
         goto cleanup;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
         goto cleanup;
@@ -3097,10 +2982,8 @@ int qemuMonitorTextSetBlockIoThrottle(qemuMonitorPtr mon,
     if (virAsprintf(&cmd, "%s %s %llu %llu %llu %llu %llu %llu", cmd_name,
                     device, info->total_bytes_sec, info->read_bytes_sec,
                     info->write_bytes_sec, info->total_iops_sec,
-                    info->read_iops_sec, info->write_iops_sec) < 0) {
-        virReportOOMError();
+                    info->read_iops_sec, info->write_iops_sec) < 0)
         goto cleanup;
-    }
 
     if (qemuMonitorHMPCommand(mon, cmd, &result) < 0)
         goto cleanup;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index f8c652f..58d72cf 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -88,10 +88,8 @@ qemuProcessRemoveDomainStatus(virQEMUDriverPtr driver,
     virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
     int ret = -1;
 
-    if (virAsprintf(&file, "%s/%s.xml", cfg->stateDir, vm->def->name) < 0) {
-        virReportOOMError();
+    if (virAsprintf(&file, "%s/%s.xml", cfg->stateDir, vm->def->name) < 0)
         goto cleanup;
-    }
 
     if (unlink(file) < 0 && errno != ENOENT && errno != ENOTDIR)
         VIR_WARN("Failed to remove domain XML for %s: %s",
@@ -465,7 +463,6 @@ qemuProcessGetVolumeQcowPassphrase(virConnectPtr conn,
     if (VIR_ALLOC_N(passphrase, size + 1) < 0) {
         memset(data, 0, size);
         VIR_FREE(data);
-        virReportOOMError();
         goto cleanup;
     }
     memcpy(passphrase, data, size);
@@ -879,8 +876,6 @@ qemuProcessHandleWatchdog(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
                     vm = NULL;
                 VIR_FREE(processEvent);
             }
-        } else {
-            virReportOOMError();
         }
     }
 
@@ -1023,24 +1018,24 @@ qemuProcessHandleGraphics(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
     int i;
 
     if (VIR_ALLOC(localAddr) < 0)
-        goto no_memory;
+        goto error;
     localAddr->family = localFamily;
     if (VIR_STRDUP(localAddr->service, localService) < 0 ||
         VIR_STRDUP(localAddr->node, localNode) < 0)
         goto error;
 
     if (VIR_ALLOC(remoteAddr) < 0)
-        goto no_memory;
+        goto error;
     remoteAddr->family = remoteFamily;
     if (VIR_STRDUP(remoteAddr->service, remoteService) < 0 ||
         VIR_STRDUP(remoteAddr->node, remoteNode) < 0)
         goto error;
 
     if (VIR_ALLOC(subject) < 0)
-        goto no_memory;
+        goto error;
     if (x509dname) {
         if (VIR_REALLOC_N(subject->identities, subject->nidentity+1) < 0)
-            goto no_memory;
+            goto error;
         subject->nidentity++;
         if (VIR_STRDUP(subject->identities[subject->nidentity-1].type, "x509dname") < 0 ||
             VIR_STRDUP(subject->identities[subject->nidentity-1].name, x509dname) < 0)
@@ -1048,7 +1043,7 @@ qemuProcessHandleGraphics(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
     }
     if (saslUsername) {
         if (VIR_REALLOC_N(subject->identities, subject->nidentity+1) < 0)
-            goto no_memory;
+            goto error;
         subject->nidentity++;
         if (VIR_STRDUP(subject->identities[subject->nidentity-1].type, "saslUsername") < 0 ||
             VIR_STRDUP(subject->identities[subject->nidentity-1].name, saslUsername) < 0)
@@ -1064,8 +1059,6 @@ qemuProcessHandleGraphics(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
 
     return 0;
 
-no_memory:
-    virReportOOMError();
 error:
     if (localAddr) {
         VIR_FREE(localAddr->service);
@@ -1296,10 +1289,8 @@ qemuProcessHandleGuestPanic(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
     struct qemuProcessEvent *processEvent;
 
     virObjectLock(vm);
-    if (VIR_ALLOC(processEvent) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC(processEvent) < 0)
         goto cleanup;
-    }
 
     processEvent->eventType = QEMU_PROCESS_EVENT_GUESTPANIC;
     processEvent->action = vm->def->onCrash;
@@ -1733,10 +1724,8 @@ qemuProcessWaitForMonitor(virQEMUDriverPtr driver,
         if ((logfd = qemuDomainOpenLog(driver, vm, pos)) < 0)
             return -1;
 
-        if (VIR_ALLOC_N(buf, buf_size) < 0) {
-            virReportOOMError();
+        if (VIR_ALLOC_N(buf, buf_size) < 0)
             goto closelog;
-        }
 
         if (qemuProcessReadLogOutput(vm, logfd, buf, buf_size,
                                      qemuProcessFindCharDevicePTYs,
@@ -1777,10 +1766,8 @@ cleanup:
             if ((logfd = qemuDomainOpenLog(driver, vm, pos)) < 0)
                 return -1;
 
-            if (VIR_ALLOC_N(buf, buf_size) < 0) {
-                virReportOOMError();
+            if (VIR_ALLOC_N(buf, buf_size) < 0)
                 goto closelog;
-            }
         }
 
         len = strlen(buf);
@@ -1820,10 +1807,8 @@ qemuProcessDetectVcpuPIDs(virQEMUDriverPtr driver,
         virResetLastError();
 
         priv->nvcpupids = 1;
-        if (VIR_ALLOC_N(priv->vcpupids, priv->nvcpupids) < 0) {
-            virReportOOMError();
+        if (VIR_ALLOC_N(priv->vcpupids, priv->nvcpupids) < 0)
             return -1;
-        }
         priv->vcpupids[0] = vm->pid;
         return 0;
     }
@@ -1864,10 +1849,8 @@ qemuPrepareCpumap(virQEMUDriverPtr driver,
     if (maxcpu > hostcpus)
         maxcpu = hostcpus;
 
-    if (!(cpumap = virBitmapNew(maxcpu))) {
-        virReportOOMError();
+    if (!(cpumap = virBitmapNew(maxcpu)))
         return NULL;
-    }
 
     if (nodemask) {
         if (!(caps = virQEMUDriverGetCapabilities(driver, false))) {
@@ -2577,13 +2560,8 @@ qemuProcessPrepareMonitorChr(virQEMUDriverConfigPtr cfg,
     monConfig->type = VIR_DOMAIN_CHR_TYPE_UNIX;
     monConfig->data.nix.listen = true;
 
-    if (virAsprintf(&monConfig->data.nix.path, "%s/%s.monitor",
-                    cfg->libDir, vm) < 0) {
-        virReportOOMError();
-        return -1;
-    }
-
-    return 0;
+    return virAsprintf(&monConfig->data.nix.path, "%s/%s.monitor",
+                       cfg->libDir, vm);
 }
 
 
@@ -3172,10 +3150,8 @@ qemuProcessReconnectHelper(virDomainObjPtr obj,
     struct qemuProcessReconnectData *src = opaque;
     struct qemuProcessReconnectData *data;
 
-    if (VIR_ALLOC(data) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC(data) < 0)
         return -1;
-    }
 
     memcpy(data, src, sizeof(*data));
     data->payload = obj;
@@ -3536,10 +3512,8 @@ int qemuProcessStart(virConnectPtr conn,
         if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC ||
             graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
             if (graphics->nListens == 0) {
-                if (VIR_EXPAND_N(graphics->listens, graphics->nListens, 1) < 0) {
-                    virReportOOMError();
+                if (VIR_EXPAND_N(graphics->listens, graphics->nListens, 1) < 0)
                     goto cleanup;
-                }
                 graphics->listens[0].type = VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS;
                 if (VIR_STRDUP(graphics->listens[0].address,
                                graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC ?
@@ -3621,10 +3595,8 @@ int qemuProcessStart(virConnectPtr conn,
     if (qemuSetupCgroup(driver, vm, nodemask) < 0)
         goto cleanup;
 
-    if (VIR_ALLOC(priv->monConfig) < 0) {
-        virReportOOMError();
+    if (VIR_ALLOC(priv->monConfig) < 0)
         goto cleanup;
-    }
 
     VIR_DEBUG("Preparing monitor state");
     if (qemuProcessPrepareMonitorChr(cfg, priv->monConfig, vm->def->name) < 0)
@@ -3693,7 +3665,6 @@ int qemuProcessStart(virConnectPtr conn,
     }
 
     if ((timestamp = virTimeStringNow()) == NULL) {
-        virReportOOMError();
         goto cleanup;
     } else {
         if (safewrite(logfile, timestamp, strlen(timestamp)) < 0 ||
@@ -4053,9 +4024,7 @@ void qemuProcessStop(virQEMUDriverPtr driver,
         VIR_WARN("Unable to open logfile: %s",
                   virStrerror(errno, ebuf, sizeof(ebuf)));
     } else {
-        if ((timestamp = virTimeStringNow()) == NULL) {
-            virReportOOMError();
-        } else {
+        if ((timestamp = virTimeStringNow()) != NULL) {
             if (safewrite(logfile, timestamp, strlen(timestamp)) < 0 ||
                 safewrite(logfile, SHUTDOWN_POSTFIX,
                           strlen(SHUTDOWN_POSTFIX)) < 0) {
@@ -4336,7 +4305,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
         }
         seclabeldef->type = VIR_DOMAIN_SECLABEL_STATIC;
         if (VIR_ALLOC(seclabel) < 0)
-            goto no_memory;
+            goto cleanup;
         if (virSecurityManagerGetProcessLabel(driver->securityManager,
                                               vm->def, vm->pid, seclabel) < 0)
             goto cleanup;
@@ -4380,7 +4349,6 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
     }
 
     if ((timestamp = virTimeStringNow()) == NULL) {
-        virReportOOMError();
         goto cleanup;
     } else {
         if (safewrite(logfile, timestamp, strlen(timestamp)) < 0 ||
@@ -4474,8 +4442,6 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
 
     return 0;
 
-no_memory:
-    virReportOOMError();
 cleanup:
     /* We jump here if we failed to start the VM for any reason, or
      * if we failed to initialize the now running VM. kill it off and
-- 
1.8.1.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]