goto error;
data.subject.subject_len = subject->nidentity;
- if (VIR_ALLOC_N(data.subject.subject_val, data.subject.subject_len) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(data.subject.subject_val, data.subject.subject_len) < 0)
goto error;
- }
for (i = 0; i < data.subject.subject_len; i++) {
if (VIR_STRDUP(data.subject.subject_val[i].type, subject->identities[i].type) < 0 ||
if (oldSrcPath &&
((VIR_ALLOC(oldSrcPath_p) < 0) ||
VIR_STRDUP(*oldSrcPath_p, oldSrcPath) < 0))
- goto mem_error;
+ goto error;
if (newSrcPath &&
((VIR_ALLOC(newSrcPath_p) < 0) ||
VIR_STRDUP(*newSrcPath_p, newSrcPath) < 0))
- goto mem_error;
+ goto error;
data.oldSrcPath = oldSrcPath_p;
data.newSrcPath = newSrcPath_p;
return 0;
-mem_error:
- virReportOOMError();
error:
VIR_FREE(oldSrcPath_p);
VIR_FREE(newSrcPath_p);
struct daemonClientPrivate *priv;
int i;
- if (VIR_ALLOC(priv) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC(priv) < 0)
return NULL;
- }
if (virMutexInit(&priv->lock) < 0) {
VIR_FREE(priv);
- virReportOOMError();
+ virReportSystemError(errno, "%s", _("unable to init mutex"));
return NULL;
}
remote_typed_param *val;
*ret_params_len = nparams;
- if (VIR_ALLOC_N(val, nparams) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(val, nparams) < 0)
goto cleanup;
- }
for (i = 0, j = 0; i < nparams; ++i) {
/* virDomainGetCPUStats can return a sparse array; also, we
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
goto cleanup;
}
- if (VIR_ALLOC_N(params, args_params_len) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(params, args_params_len) < 0)
goto cleanup;
- }
*nparams = args_params_len;
goto cleanup;
}
if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0)
- goto no_memory;
+ goto cleanup;
nparams = args->nparams;
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
if (dom)
virDomainFree(dom);
return rv;
-
-no_memory:
- virReportOOMError();
- goto cleanup;
}
static int
goto cleanup;
if (doms && ndomains) {
- if (VIR_ALLOC_N(ret->domains.domains_val, ndomains) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(ret->domains.domains_val, ndomains) < 0)
goto cleanup;
- }
ret->domains.domains_len = ndomains;
goto cleanup;
}
if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0)
- goto no_memory;
+ goto cleanup;
nparams = args->nparams;
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
if (dom)
virDomainFree(dom);
return rv;
-
-no_memory:
- virReportOOMError();
- goto cleanup;
}
static int
goto cleanup;
/* Allocate stats array for making dispatch call */
- if (VIR_ALLOC_N(stats, args->maxStats) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(stats, args->maxStats) < 0)
goto cleanup;
- }
nr_stats = virDomainMemoryStats(dom, stats, args->maxStats, args->flags);
if (nr_stats < 0)
goto cleanup;
/* Allocate return buffer */
- if (VIR_ALLOC_N(ret->stats.stats_val, args->maxStats) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(ret->stats.stats_val, args->maxStats) < 0)
goto cleanup;
- }
/* Copy the stats into the xdr return structure */
for (i = 0; i < nr_stats; i++) {
}
ret->buffer.buffer_len = size;
- if (VIR_ALLOC_N(ret->buffer.buffer_val, size) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(ret->buffer.buffer_val, size) < 0)
goto cleanup;
- }
if (virDomainBlockPeek(dom, path, offset, size,
ret->buffer.buffer_val, flags) < 0)
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
goto cleanup;
}
- if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0) {
- virReportOOMError();
+ if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0)
goto cleanup;
- }
nparams = args->nparams;
if (virDomainBlockStatsFlags(dom, path, params, &nparams, flags) < 0)
}
ret->buffer.buffer_len = size;
- if (VIR_ALLOC_N(ret->buffer.buffer_val, size) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(ret->buffer.buffer_val, size) < 0)
goto cleanup;
- }
if (virDomainMemoryPeek(dom, offset, size,
ret->buffer.buffer_val, flags) < 0)
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
goto cleanup;
- if (VIR_ALLOC(seclabel) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC(seclabel) < 0)
goto cleanup;
- }
if (virDomainGetSecurityLabel(dom, seclabel) < 0)
goto cleanup;
ret->label.label_len = strlen(seclabel->label) + 1;
- if (VIR_ALLOC_N(ret->label.label_val, ret->label.label_len) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(ret->label.label_val, ret->label.label_len) < 0)
goto cleanup;
- }
strcpy(ret->label.label_val, seclabel->label);
ret->enforcing = seclabel->enforcing;
goto done;
}
- if (VIR_ALLOC_N(ret->labels.labels_val, len) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(ret->labels.labels_val, len) < 0)
goto cleanup;
- }
for (i = 0; i < len; i++) {
size_t label_len = strlen(seclabels[i].label) + 1;
remote_domain_get_security_label_ret *cur = &ret->labels.labels_val[i];
- if (VIR_ALLOC_N(cur->label.label_val, label_len) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(cur->label.label_val, label_len) < 0)
goto cleanup;
- }
if (virStrcpy(cur->label.label_val, seclabels[i].label, label_len) == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("failed to copy security label"));
goto cleanup;
ret->model.model_len = strlen(secmodel.model) + 1;
- if (VIR_ALLOC_N(ret->model.model_val, ret->model.model_len) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(ret->model.model_val, ret->model.model_len) < 0)
goto cleanup;
- }
strcpy(ret->model.model_val, secmodel.model);
ret->doi.doi_len = strlen(secmodel.doi) + 1;
- if (VIR_ALLOC_N(ret->doi.doi_val, ret->doi.doi_len) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(ret->doi.doi_val, ret->doi.doi_len) < 0)
goto cleanup;
- }
strcpy(ret->doi.doi_val, secmodel.doi);
rv = 0;
/* Allocate buffers to take the results. */
if (args->maplen > 0 &&
VIR_ALLOC_N(cpumaps, args->ncpumaps * args->maplen) < 0)
- goto no_memory;
+ goto cleanup;
if ((num = virDomainGetVcpuPinInfo(dom,
args->ncpumaps,
if (dom)
virDomainFree(dom);
return rv;
-
-no_memory:
- virReportOOMError();
- goto cleanup;
}
static int
/* Allocate buffers to take the results */
if (args->maplen > 0 &&
VIR_ALLOC_N(cpumaps, args->maplen) < 0)
- goto no_memory;
+ goto cleanup;
if ((r = virDomainGetEmulatorPinInfo(dom,
cpumaps,
if (dom)
virDomainFree(dom);
return rv;
-
-no_memory:
- virReportOOMError();
- goto cleanup;
}
static int
/* Allocate buffers to take the results. */
if (VIR_ALLOC_N(info, args->maxinfo) < 0)
- goto no_memory;
+ goto cleanup;
if (args->maplen > 0 &&
VIR_ALLOC_N(cpumaps, args->maxinfo * args->maplen) < 0)
- goto no_memory;
+ goto cleanup;
if ((info_len = virDomainGetVcpus(dom,
info, args->maxinfo,
/* Allocate the return buffer for info. */
ret->info.info_len = info_len;
if (VIR_ALLOC_N(ret->info.info_val, info_len) < 0)
- goto no_memory;
+ goto cleanup;
for (i = 0; i < info_len; ++i) {
ret->info.info_val[i].number = info[i].number;
if (dom)
virDomainFree(dom);
return rv;
-
-no_memory:
- virReportOOMError();
- goto cleanup;
}
static int
dname = args->dname == NULL ? NULL : *args->dname;
/* Wacky world of XDR ... */
- if (VIR_ALLOC(uri_out) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC(uri_out) < 0)
goto cleanup;
- }
if (virDomainMigratePrepare(priv->conn, &cookie, &cookielen,
uri_in, uri_out,
dname = args->dname == NULL ? NULL : *args->dname;
/* Wacky world of XDR ... */
- if (VIR_ALLOC(uri_out) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC(uri_out) < 0)
goto cleanup;
- }
if (virDomainMigratePrepare2(priv->conn, &cookie, &cookielen,
uri_in, uri_out,
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
goto cleanup;
}
- if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0) {
- virReportOOMError();
+ if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0)
goto cleanup;
- }
nparams = args->nparams;
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
goto cleanup;
}
- if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0) {
- virReportOOMError();
+ if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0)
goto cleanup;
- }
nparams = args->nparams;
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
goto cleanup;
}
- if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0) {
- virReportOOMError();
+ if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0)
goto cleanup;
- }
nparams = args->nparams;
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
goto cleanup;
}
- if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0) {
- virReportOOMError();
+ if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0)
goto cleanup;
- }
nparams = args->nparams;
if (virNodeGetCPUStats(priv->conn, cpuNum, params, &nparams, flags) < 0)
/* Serialise the memory parameters. */
ret->params.params_len = nparams;
if (VIR_ALLOC_N(ret->params.params_val, nparams) < 0)
- goto no_memory;
+ goto cleanup;
for (i = 0; i < nparams; ++i) {
/* remoteDispatchClientRequest will free this: */
}
VIR_FREE(params);
return rv;
-
-no_memory:
- virReportOOMError();
- goto cleanup;
}
static int
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
goto cleanup;
}
- if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0) {
- virReportOOMError();
+ if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0)
goto cleanup;
- }
nparams = args->nparams;
if (virNodeGetMemoryStats(priv->conn, cellNum, params, &nparams, flags) < 0)
/* Serialise the memory parameters. */
ret->params.params_len = nparams;
if (VIR_ALLOC_N(ret->params.params_val, nparams) < 0)
- goto no_memory;
+ goto cleanup;
for (i = 0; i < nparams; ++i) {
/* remoteDispatchClientRequest will free this: */
}
VIR_FREE(params);
return rv;
-
-no_memory:
- virReportOOMError();
- goto cleanup;
}
static int
goto cleanup;
}
- if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0) {
- virReportOOMError();
+ if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0)
goto cleanup;
- }
nparams = args->nparams;
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
} else if (callerUid == 0) {
char *ident;
if (virAsprintf(&ident, "pid:%lld,uid:%d",
- (long long) callerPid, (int) callerUid) < 0) {
- virReportOOMError();
+ (long long) callerPid, (int) callerUid) < 0)
goto cleanup;
- }
VIR_INFO("Bypass polkit auth for privileged client %s", ident);
virNetServerClientSetAuth(client, 0);
auth = VIR_NET_SERVER_SERVICE_AUTH_NONE;
}
ret->types.types_len = 1;
- if (VIR_ALLOC_N(ret->types.types_val, ret->types.types_len) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(ret->types.types_val, ret->types.types_len) < 0)
goto cleanup;
- }
switch (auth) {
case VIR_NET_SERVER_SERVICE_AUTH_NONE:
virCommandAddArg(cmd, "--allow-user-interaction");
if (virAsprintf(&ident, "pid:%lld,uid:%d",
- (long long) callerPid, callerUid) < 0) {
- virReportOOMError();
+ (long long) callerPid, callerUid) < 0)
goto authfail;
- }
if (virCommandRun(cmd, &status) < 0)
goto authfail;
}
if (virAsprintf(&ident, "pid:%lld,uid:%d",
- (long long) callerPid, callerUid) < 0) {
- virReportOOMError();
+ (long long) callerPid, callerUid) < 0)
goto authfail;
- }
if (!(sysbus = virDBusGetSystemBus()))
goto authfail;
} else {
/* remoteDispatchClientRequest will free this. */
char **parent_p;
- if (VIR_ALLOC(parent_p) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC(parent_p) < 0)
goto cleanup;
- }
if (VIR_STRDUP(*parent_p, parent) < 0) {
VIR_FREE(parent_p);
goto cleanup;
dname = args->dname == NULL ? NULL : *args->dname;
/* Wacky world of XDR ... */
- if (VIR_ALLOC(uri_out) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC(uri_out) < 0)
goto cleanup;
- }
if (virDomainMigratePrepare3(priv->conn,
args->cookie_in.cookie_in_val,
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
goto cleanup;
}
- if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0) {
- virReportOOMError();
+ if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0)
goto cleanup;
- }
nparams = args->nparams;
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
}
if (args->nparams > 0 &&
- VIR_ALLOC_N(params, args->ncpus * args->nparams) < 0) {
- virReportOOMError();
+ VIR_ALLOC_N(params, args->ncpus * args->nparams) < 0)
goto cleanup;
- }
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
goto cleanup;
}
if (args->maxerrors &&
- VIR_ALLOC_N(errors, args->maxerrors) < 0) {
- virReportOOMError();
+ VIR_ALLOC_N(errors, args->maxerrors) < 0)
goto cleanup;
- }
if ((len = virDomainGetDiskErrors(dom, errors,
args->maxerrors,
goto cleanup;
if (snaps && nsnaps) {
- if (VIR_ALLOC_N(ret->snapshots.snapshots_val, nsnaps) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(ret->snapshots.snapshots_val, nsnaps) < 0)
goto cleanup;
- }
ret->snapshots.snapshots_len = nsnaps;
goto cleanup;
if (snaps && nsnaps) {
- if (VIR_ALLOC_N(ret->snapshots.snapshots_val, nsnaps) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(ret->snapshots.snapshots_val, nsnaps) < 0)
goto cleanup;
- }
ret->snapshots.snapshots_len = nsnaps;
goto cleanup;
if (pools && npools) {
- if (VIR_ALLOC_N(ret->pools.pools_val, npools) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(ret->pools.pools_val, npools) < 0)
goto cleanup;
- }
ret->pools.pools_len = npools;
goto cleanup;
if (vols && nvols) {
- if (VIR_ALLOC_N(ret->vols.vols_val, nvols) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(ret->vols.vols_val, nvols) < 0)
goto cleanup;
- }
ret->vols.vols_len = nvols;
goto cleanup;
if (nets && nnets) {
- if (VIR_ALLOC_N(ret->nets.nets_val, nnets) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(ret->nets.nets_val, nnets) < 0)
goto cleanup;
- }
ret->nets.nets_len = nnets;
goto cleanup;
if (ifaces && nifaces) {
- if (VIR_ALLOC_N(ret->ifaces.ifaces_val, nifaces) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(ret->ifaces.ifaces_val, nifaces) < 0)
goto cleanup;
- }
ret->ifaces.ifaces_len = nifaces;
goto cleanup;
if (devices && ndevices) {
- if (VIR_ALLOC_N(ret->devices.devices_val, ndevices) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(ret->devices.devices_val, ndevices) < 0)
goto cleanup;
- }
ret->devices.devices_len = ndevices;
goto cleanup;
if (filters && nfilters) {
- if (VIR_ALLOC_N(ret->filters.filters_val, nfilters) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(ret->filters.filters_val, nfilters) < 0)
goto cleanup;
- }
ret->filters.filters_len = nfilters;
goto cleanup;
if (secrets && nsecrets) {
- if (VIR_ALLOC_N(ret->secrets.secrets_val, nsecrets) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(ret->secrets.secrets_val, nsecrets) < 0)
goto cleanup;
- }
ret->secrets.secrets_len = nsecrets;
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
goto cleanup;
}
- if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0) {
- virReportOOMError();
+ if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0)
goto cleanup;
- }
nparams = args->nparams;
if (virNodeGetMemoryParameters(priv->conn, params, &nparams, flags) < 0)
goto cleanup;
/* Wacky world of XDR ... */
- if (VIR_ALLOC(uri_out) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC(uri_out) < 0)
goto cleanup;
- }
if (virDomainMigratePrepare3Params(priv->conn, params, nparams,
args->cookie_in.cookie_in_val,
remote_domain_disk_error *val = NULL;
int i = 0;
- if (VIR_ALLOC_N(val, nerrors) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(val, nerrors) < 0)
goto error;
- }
for (i = 0; i < nerrors; i++) {
if (VIR_STRDUP(val[i].disk, errors[i].disk) < 0)