int i;
if ((caps = virCapabilitiesNew(VIR_ARCH_I686, 0, 0)) == NULL)
- goto no_memory;
+ goto error;
if (virCapabilitiesAddHostFeature(caps, "pae") < 0)
- goto no_memory;
+ goto error;
if (virCapabilitiesAddHostFeature(caps ,"nonpae") < 0)
- goto no_memory;
+ goto error;
for (i = 0; i < privconn->numCells; i++) {
virCapsHostNUMACellCPUPtr cpu_cells;
if (VIR_ALLOC_N(cpu_cells, privconn->cells[i].numCpus) < 0)
- goto no_memory;
+ goto error;
memcpy(cpu_cells, privconn->cells[i].cpus,
sizeof(*cpu_cells) * privconn->cells[i].numCpus);
if (virCapabilitiesAddHostNUMACell(caps, i, privconn->cells[i].numCpus,
0, cpu_cells) < 0)
- goto no_memory;
+ goto error;
}
for (i = 0; i < ARRAY_CARDINALITY(guest_types); i++) {
NULL,
0,
NULL)) == NULL)
- goto no_memory;
+ goto error;
if (virCapabilitiesAddGuestDomain(guest,
"test",
NULL,
0,
NULL) == NULL)
- goto no_memory;
+ goto error;
if (virCapabilitiesAddGuestFeature(guest, "pae", 1, 1) == NULL)
- goto no_memory;
+ goto error;
if (virCapabilitiesAddGuestFeature(guest ,"nonpae", 1, 1) == NULL)
- goto no_memory;
+ goto error;
}
caps->host.nsecModels = 1;
if (VIR_ALLOC_N(caps->host.secModels, caps->host.nsecModels) < 0)
- goto no_memory;
+ goto error;
if (VIR_STRDUP(caps->host.secModels[0].model, "testSecurity") < 0)
goto error;
return caps;
-no_memory:
- virReportOOMError();
error:
virObjectUnref(caps);
return NULL;
char *ifname;
int found = 0;
- if (virAsprintf(&ifname, "testnet%d", ifctr) < 0) {
- virReportOOMError();
+ if (virAsprintf(&ifname, "testnet%d", ifctr) < 0)
return NULL;
- }
/* Generate network interface names */
for (i = 0; i < domdef->nnets; i++) {
maxcpu = VIR_NODEINFO_MAXCPUS(privconn->nodeInfo);
cpumaplen = VIR_CPU_MAPLEN(maxcpu);
- if (VIR_REALLOC_N(privdata->vcpu_infos, nvcpus) < 0) {
- virReportOOMError();
+ if (VIR_REALLOC_N(privdata->vcpu_infos, nvcpus) < 0)
goto cleanup;
- }
- if (VIR_REALLOC_N(privdata->cpumaps, nvcpus * cpumaplen) < 0) {
- virReportOOMError();
+ if (VIR_REALLOC_N(privdata->cpumaps, nvcpus * cpumaplen) < 0)
goto cleanup;
- }
/* Set running VCPU and cpumap state */
if (clear_all) {
virNodeDeviceDefPtr nodedef = NULL;
virNodeDeviceObjPtr nodeobj = NULL;
- if (VIR_ALLOC(privconn) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC(privconn) < 0)
return VIR_DRV_OPEN_ERROR;
- }
if (virMutexInit(&privconn->lock) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot initialize mutex"));
}
for (u = 0; u < 16; u++) {
virBitmapPtr siblings = virBitmapNew(16);
- if (!siblings) {
- virReportOOMError();
+ if (!siblings)
goto error;
- }
ignore_value(virBitmapSetBit(siblings, u));
privconn->cells[u / 8].cpus[(u % 8)].id = u;
privconn->cells[u / 8].cpus[(u % 8)].socket_id = u / 8;
virStorageVolDefPtr def = NULL;
/* Find storage volumes */
- if (virAsprintf(&vol_xpath, "/node/pool[%d]/volume", poolidx) < 0) {
- virReportOOMError();
+ if (virAsprintf(&vol_xpath, "/node/pool[%d]/volume", poolidx) < 0)
goto error;
- }
ret = virXPathNodeSet(vol_xpath, ctxt, &vols);
VIR_FREE(vol_xpath);
}
if (VIR_REALLOC_N(pool->volumes.objs,
- pool->volumes.count+1) < 0) {
- virReportOOMError();
+ pool->volumes.count+1) < 0)
goto error;
- }
if (def->target.path == NULL) {
if (virAsprintf(&def->target.path, "%s/%s",
pool->def->target.path,
- def->name) == -1) {
- virReportOOMError();
+ def->name) == -1)
goto error;
- }
}
if (!def->key && VIR_STRDUP(def->key, def->target.path) < 0)
virInterfaceObjPtr iface;
virDomainObjPtr dom;
testConnPtr privconn;
- if (VIR_ALLOC(privconn) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC(privconn) < 0)
return VIR_DRV_OPEN_ERROR;
- }
if (virMutexInit(&privconn->lock) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot initialize mutex"));
"%s", _("length of metadata out of range"));
goto cleanup;
}
- if (VIR_ALLOC_N(xml, len+1) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(xml, len+1) < 0)
goto cleanup;
- }
if (saferead(fd, xml, len) != len) {
virReportSystemError(errno,
_("incomplete metdata in '%s'"), path);
goto cleanup;
}
- if (virAsprintf(&ret, defaultPoolSourcesNetFSXML,
- source->hosts[0].name) < 0)
- virReportOOMError();
+ ignore_value(virAsprintf(&ret, defaultPoolSourcesNetFSXML,
+ source->hosts[0].name));
break;
default:
goto cleanup;
}
- if (VIR_ALLOC_N(tmp_vols, pool->volumes.count + 1) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(tmp_vols, pool->volumes.count + 1) < 0)
goto cleanup;
- }
for (i = 0; i < pool->volumes.count; i++) {
if (!(vol = virGetStorageVol(obj->conn, pool->def->name,
}
if (VIR_REALLOC_N(privpool->volumes.objs,
- privpool->volumes.count+1) < 0) {
- virReportOOMError();
+ privpool->volumes.count+1) < 0)
goto cleanup;
- }
if (virAsprintf(&privvol->target.path, "%s/%s",
privpool->def->target.path,
- privvol->name) == -1) {
- virReportOOMError();
+ privvol->name) == -1)
goto cleanup;
- }
if (VIR_STRDUP(privvol->key, privvol->target.path) < 0)
goto cleanup;
privpool->def->allocation);
if (VIR_REALLOC_N(privpool->volumes.objs,
- privpool->volumes.count+1) < 0) {
- virReportOOMError();
+ privpool->volumes.count+1) < 0)
goto cleanup;
- }
if (virAsprintf(&privvol->target.path, "%s/%s",
privpool->def->target.path,
- privvol->name) == -1) {
- virReportOOMError();
+ privvol->name) == -1)
goto cleanup;
- }
if (VIR_STRDUP(privvol->key, privvol->target.path) < 0)
goto cleanup;
testDriverLock(privconn);
if (cpumap) {
- if (VIR_ALLOC_N(*cpumap, 1) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(*cpumap, 1) < 0)
goto cleanup;
- }
*cpumap[0] = 0x15;
}