cpus[id].core_id = c;
if (!(cpus[id].siblings = virBitmapNew(ncpus)))
goto error;
- if (virBitmapSetBit(cpus[id].siblings, id) < 0)
- goto error;
+ ignore_value(virBitmapSetBit(cpus[id].siblings, id));
id++;
}
}
if ((caps = virCapabilitiesNew(virArchFromHost(),
0, 0)) == NULL)
- goto no_memory;
+ return NULL;
if (nodeCapsInitNUMA(caps) < 0)
- goto no_memory;
+ goto error;
if ((guest = virCapabilitiesAddGuest(caps, "hvm",
VIR_ARCH_X86_64,
"parallels",
NULL, 0, NULL)) == NULL)
- goto no_memory;
+ goto error;
if (virCapabilitiesAddGuestDomain(guest,
"parallels", NULL, NULL, 0, NULL) == NULL)
- goto no_memory;
+ goto error;
if ((guest = virCapabilitiesAddGuest(caps, "exe",
VIR_ARCH_X86_64,
"parallels",
NULL, 0, NULL)) == NULL)
- goto no_memory;
+ goto error;
if (virCapabilitiesAddGuestDomain(guest,
"parallels", NULL, NULL, 0, NULL) == NULL)
- goto no_memory;
+ goto error;
return caps;
- no_memory:
- virReportOOMError();
+ error:
virObjectUnref(caps);
return NULL;
}
virDomainChrDefPtr chr = NULL;
if (!(chr = virDomainChrDefNew()))
- goto no_memory;
+ goto cleanup;
if (parallelsGetSerialInfo(chr, key, value))
goto cleanup;
if (VIR_REALLOC_N(*serials, *nserials + 1) < 0)
- goto no_memory;
+ goto cleanup;
(*serials)[(*nserials)++] = chr;
return 0;
- no_memory:
- virReportOOMError();
cleanup:
virDomainChrDefFree(chr);
return -1;
}
if (VIR_ALLOC(video) < 0)
- goto no_memory;
+ goto error;
if (VIR_ALLOC(accel) < 0)
- goto no_memory;
+ goto error;
if (VIR_REALLOC_N(def->videos, def->nvideos + 1) < 0)
- goto no_memory;
+ goto error;
def->videos[def->nvideos++] = video;
return 0;
-no_memory:
- virReportOOMError();
+error:
VIR_FREE(accel);
virDomainVideoDefFree(video);
-error:
return -1;
}
virDomainDiskDefPtr disk = NULL;
if (VIR_ALLOC(disk) < 0)
- goto no_memory;
+ goto error;
if (parallelsGetHddInfo(def, disk, key, value))
goto error;
if (VIR_REALLOC_N(def->disks, def->ndisks + 1) < 0)
- goto no_memory;
+ goto error;
def->disks[def->ndisks++] = disk;
return 0;
-no_memory:
- virReportOOMError();
error:
virDomainDiskDefFree(disk);
return -1;
virDomainNetDefPtr net = NULL;
if (VIR_ALLOC(net) < 0)
- goto no_memory;
+ goto error;
if (parallelsGetNetInfo(net, key, value))
goto error;
if (VIR_EXPAND_N(def->nets, def->nnets, 1) < 0)
- goto no_memory;
+ goto error;
def->nets[def->nnets - 1] = net;
return 0;
-no_memory:
- virReportOOMError();
error:
virDomainNetDefFree(net);
return -1;
}
if (VIR_ALLOC(gr) < 0)
- goto no_memory;
+ goto cleanup;
if (STREQ(tmp, "auto")) {
if (virJSONValueObjectGetNumberUint(jobj, "port", &port) < 0)
}
if (VIR_ALLOC(gr->listens) < 0)
- goto no_memory;
+ goto cleanup;
gr->nListens = 1;
gr->listens[0].type = VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS;
if (VIR_REALLOC_N(def->graphics, def->ngraphics + 1) < 0)
- goto no_memory;
+ goto cleanup;
def->graphics[def->ngraphics++] = gr;
return 0;
- no_memory:
- virReportOOMError();
cleanup:
virDomainGraphicsDefFree(gr);
return ret;
const char *state;
if (VIR_ALLOC(def) < 0)
- goto no_memory;
+ goto cleanup;
def->virtType = VIR_DOMAIN_VIRT_PARALLELS;
def->id = -1;
def->os.arch = VIR_ARCH_X86_64;
if (VIR_ALLOC(pdom) < 0)
- goto no_memory;
+ goto cleanup;
if (virJSONValueObjectGetNumberUint(jobj, "EnvID", &x) < 0)
goto cleanup;
return dom;
- no_memory:
- virReportOOMError();
cleanup:
virDomainDefFree(def);
parallelsDomObjFreePrivate(pdom);
{
parallelsConnPtr 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"));
if (!oldnet) {
create = true;
- if (VIR_ALLOC(oldnet) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC(oldnet) < 0)
return -1;
- }
}
if (!create && oldnet->type != newnet->type) {
}
if (virAsprintf(&bridgeLink, "%s/%s/brport/bridge",
- SYSFS_NET_DIR, ifname) < 0) {
- virReportOOMError();
+ SYSFS_NET_DIR, ifname) < 0)
goto cleanup;
- }
if (virFileResolveLink(bridgeLink, &bridgePath) < 0) {
virReportSystemError(errno, _("cannot read link '%s'"), bridgeLink);
goto cleanup;
if (virAsprintf(&bridgeAddressPath, "%s/%s/brport/bridge/address",
- SYSFS_NET_DIR, ifname) < 0) {
- virReportOOMError();
+ SYSFS_NET_DIR, ifname) < 0)
goto cleanup;
- }
if ((len = virFileReadAll(bridgeAddressPath, 18, &bridgeAddress)) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
virJSONValuePtr jobj = NULL, jobj2;
int ret = -1;
- if (VIR_EXPAND_N(def->ips, def->nips, 1) < 0) {
- virReportOOMError();
+ if (VIR_EXPAND_N(def->ips, def->nips, 1) < 0)
goto cleanup;
- }
jobj = parallelsParseOutput("prlsrvctl", "net", "info", "-j", name, NULL);
goto cleanup;
}
- if (VIR_EXPAND_N(def->ips[0].ranges, def->ips[0].nranges, 1) < 0) {
- virReportOOMError();
+ if (VIR_EXPAND_N(def->ips[0].ranges, def->ips[0].nranges, 1) < 0)
goto cleanup;
- }
if (!(tmp = virJSONValueObjectGetString(jobj2, "IP scope start address"))) {
parallelsParseError();
unsigned char md5[MD5_DIGEST_SIZE];
if (VIR_ALLOC(def) < 0)
- goto no_memory;
+ goto cleanup;
if (!(tmp = virJSONValueObjectGetString(jobj, "Network ID"))) {
parallelsParseError();
virNetworkObjUnlock(net);
return net;
-no_memory:
- virReportOOMError();
cleanup:
virNetworkDefFree(def);
return NULL;
virNetworkDefPtr def;
if (VIR_ALLOC(def) < 0)
- goto no_memory;
+ goto cleanup;
def->forward.type = VIR_NETWORK_FORWARD_ROUTE;
return net;
-no_memory:
- virReportOOMError();
cleanup:
virNetworkDefFree(def);
return NULL;
continue;
if (!(path = virFileBuildPath(pool->def->target.path,
- ent->d_name, NULL))) {
- virReportOOMError();
+ ent->d_name, NULL)))
goto cleanup;
- }
if (!parallelsStorageVolDefineXML(pool, NULL, path, false))
goto cleanup;
virStoragePoolObjPtr pool = NULL;
if (VIR_ALLOC(def) < 0)
- goto no_memory;
+ goto error;
if (!(def->name = parallelsMakePoolName(conn, path)))
goto error;
if (VIR_ALLOC_N(def->uuid, VIR_UUID_BUFLEN))
- goto no_memory;
+ goto error;
if (virUUIDGenerate(def->uuid)) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
virStoragePoolObjUnlock(pool);
return pool;
-no_memory:
- virReportOOMError();
error:
virStoragePoolDefFree(def);
if (pool)
virStorageVolDefPtr def = NULL;
if (VIR_ALLOC(def))
- goto no_memory;
+ goto error;
if (virAsprintf(&def->name, "%s-%s", dom->def->name, diskName) < 0)
- goto no_memory;
+ goto error;
def->type = VIR_STORAGE_VOL_FILE;
goto error;
if (VIR_REALLOC_N(pool->volumes.objs, pool->volumes.count + 1) < 0)
- goto no_memory;
+ goto error;
pool->volumes.objs[pool->volumes.count++] = def;
VIR_FREE(diskPath);
VIR_FREE(diskDescPath);
- if (!(diskPath = virFileBuildPath(pdom->home, ent->d_name, NULL))) {
- virReportOOMError();
+ if (!(diskPath = virFileBuildPath(pdom->home, ent->d_name, NULL)))
goto cleanup;
- }
if (lstat(diskPath, &sb) < 0) {
virReportSystemError(errno,
continue;
if (!(diskDescPath = virFileBuildPath(diskPath,
- "DiskDescriptor", ".xml"))) {
- virReportOOMError();
+ "DiskDescriptor", ".xml")))
goto cleanup;
- }
if (access(diskDescPath, F_OK))
continue;
/* Configuration path is /etc/libvirt/parallels-storage/... . */
if (virAsprintf(&storageState->configDir,
"%s/parallels-storage", base) == -1)
- goto out_of_memory;
+ goto error;
if (virAsprintf(&storageState->autostartDir,
"%s/parallels-storage/autostart", base) == -1)
- goto out_of_memory;
+ goto error;
VIR_FREE(base);
return 0;
-out_of_memory:
- virReportOOMError();
error:
VIR_FREE(base);
return -1;
if (STRNEQ(conn->driver->name, "Parallels"))
return VIR_DRV_OPEN_DECLINED;
- if (VIR_ALLOC(storageState) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC(storageState) < 0)
return VIR_DRV_OPEN_ERROR;
- }
if (virMutexInit(&storageState->lock) < 0) {
VIR_FREE(storageState);
}
}
- if (VIR_REALLOC_N(pool->volumes.objs, pool->volumes.count + 1) < 0) {
- virReportOOMError();
+ if (VIR_REALLOC_N(pool->volumes.objs, pool->volumes.count + 1) < 0)
goto cleanup;
- }
if (virAsprintf(&privvol->target.path, "%s/%s",
- pool->def->target.path, privvol->name) < 0) {
- virReportOOMError();
+ pool->def->target.path, privvol->name) < 0)
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();
+ privpool->def->target.path, privvol->name) == -1)
goto cleanup;
- }
if (VIR_STRDUP(privvol->key, privvol->target.path) < 0)
goto cleanup;
char *new_path = NULL;
size_t len = strlen(path) + strlen(ext) + 1;
- if (VIR_ALLOC_N(new_path, len) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(new_path, len) < 0)
return NULL;
- }
if (!virStrcpy(new_path, path, len)) {
VIR_FREE(new_path);