mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
Adapt to VIR_ALLOC and virAsprintf in daemon/*
This commit is contained in:
parent
9021488a5b
commit
1b3e1d3ba5
@ -200,15 +200,13 @@ daemonConfigFilePath(bool privileged, char **configfile)
|
|||||||
|
|
||||||
if (virAsprintf(configfile, "%s/libvirtd.conf", configdir) < 0) {
|
if (virAsprintf(configfile, "%s/libvirtd.conf", configdir) < 0) {
|
||||||
VIR_FREE(configdir);
|
VIR_FREE(configdir);
|
||||||
goto no_memory;
|
goto error;
|
||||||
}
|
}
|
||||||
VIR_FREE(configdir);
|
VIR_FREE(configdir);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
no_memory:
|
|
||||||
virReportOOMError();
|
|
||||||
error:
|
error:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -220,10 +218,8 @@ daemonConfigNew(bool privileged ATTRIBUTE_UNUSED)
|
|||||||
char *localhost;
|
char *localhost;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (VIR_ALLOC(data) < 0) {
|
if (VIR_ALLOC(data) < 0)
|
||||||
virReportOOMError();
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
data->listen_tls = 1;
|
data->listen_tls = 1;
|
||||||
data->listen_tcp = 0;
|
data->listen_tcp = 0;
|
||||||
@ -294,12 +290,10 @@ daemonConfigNew(bool privileged ATTRIBUTE_UNUSED)
|
|||||||
}
|
}
|
||||||
VIR_FREE(localhost);
|
VIR_FREE(localhost);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto no_memory;
|
goto error;
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
|
||||||
no_memory:
|
|
||||||
virReportOOMError();
|
|
||||||
error:
|
error:
|
||||||
daemonConfigFree(data);
|
daemonConfigFree(data);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -263,7 +263,7 @@ daemonPidFilePath(bool privileged,
|
|||||||
|
|
||||||
if (virAsprintf(pidfile, "%s/libvirtd.pid", rundir) < 0) {
|
if (virAsprintf(pidfile, "%s/libvirtd.pid", rundir) < 0) {
|
||||||
VIR_FREE(rundir);
|
VIR_FREE(rundir);
|
||||||
goto no_memory;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
VIR_FREE(rundir);
|
VIR_FREE(rundir);
|
||||||
@ -271,8 +271,6 @@ daemonPidFilePath(bool privileged,
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
no_memory:
|
|
||||||
virReportOOMError();
|
|
||||||
error:
|
error:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -285,10 +283,10 @@ daemonUnixSocketPaths(struct daemonConfig *config,
|
|||||||
{
|
{
|
||||||
if (config->unix_sock_dir) {
|
if (config->unix_sock_dir) {
|
||||||
if (virAsprintf(sockfile, "%s/libvirt-sock", config->unix_sock_dir) < 0)
|
if (virAsprintf(sockfile, "%s/libvirt-sock", config->unix_sock_dir) < 0)
|
||||||
goto no_memory;
|
goto error;
|
||||||
if (privileged &&
|
if (privileged &&
|
||||||
virAsprintf(rosockfile, "%s/libvirt-sock-ro", config->unix_sock_dir) < 0)
|
virAsprintf(rosockfile, "%s/libvirt-sock-ro", config->unix_sock_dir) < 0)
|
||||||
goto no_memory;
|
goto error;
|
||||||
} else {
|
} else {
|
||||||
if (privileged) {
|
if (privileged) {
|
||||||
if (VIR_STRDUP(*sockfile, LOCALSTATEDIR "/run/libvirt/libvirt-sock") < 0 ||
|
if (VIR_STRDUP(*sockfile, LOCALSTATEDIR "/run/libvirt/libvirt-sock") < 0 ||
|
||||||
@ -310,7 +308,7 @@ daemonUnixSocketPaths(struct daemonConfig *config,
|
|||||||
|
|
||||||
if (virAsprintf(sockfile, "%s/libvirt-sock", rundir) < 0) {
|
if (virAsprintf(sockfile, "%s/libvirt-sock", rundir) < 0) {
|
||||||
VIR_FREE(rundir);
|
VIR_FREE(rundir);
|
||||||
goto no_memory;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
VIR_FREE(rundir);
|
VIR_FREE(rundir);
|
||||||
@ -318,8 +316,6 @@ daemonUnixSocketPaths(struct daemonConfig *config,
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
no_memory:
|
|
||||||
virReportOOMError();
|
|
||||||
error:
|
error:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -666,7 +662,7 @@ daemonSetupLogging(struct daemonConfig *config,
|
|||||||
char *tmp;
|
char *tmp;
|
||||||
if (access("/run/systemd/journal/socket", W_OK) >= 0) {
|
if (access("/run/systemd/journal/socket", W_OK) >= 0) {
|
||||||
if (virAsprintf(&tmp, "%d:journald", virLogGetDefaultPriority()) < 0)
|
if (virAsprintf(&tmp, "%d:journald", virLogGetDefaultPriority()) < 0)
|
||||||
goto no_memory;
|
goto error;
|
||||||
virLogParseOutputs(tmp);
|
virLogParseOutputs(tmp);
|
||||||
VIR_FREE(tmp);
|
VIR_FREE(tmp);
|
||||||
}
|
}
|
||||||
@ -684,7 +680,7 @@ daemonSetupLogging(struct daemonConfig *config,
|
|||||||
if (virAsprintf(&tmp, "%d:file:%s/log/libvirt/libvirtd.log",
|
if (virAsprintf(&tmp, "%d:file:%s/log/libvirt/libvirtd.log",
|
||||||
virLogGetDefaultPriority(),
|
virLogGetDefaultPriority(),
|
||||||
LOCALSTATEDIR) == -1)
|
LOCALSTATEDIR) == -1)
|
||||||
goto no_memory;
|
goto error;
|
||||||
} else {
|
} else {
|
||||||
char *logdir = virGetUserCacheDirectory();
|
char *logdir = virGetUserCacheDirectory();
|
||||||
mode_t old_umask;
|
mode_t old_umask;
|
||||||
@ -702,13 +698,13 @@ daemonSetupLogging(struct daemonConfig *config,
|
|||||||
if (virAsprintf(&tmp, "%d:file:%s/libvirtd.log",
|
if (virAsprintf(&tmp, "%d:file:%s/libvirtd.log",
|
||||||
virLogGetDefaultPriority(), logdir) == -1) {
|
virLogGetDefaultPriority(), logdir) == -1) {
|
||||||
VIR_FREE(logdir);
|
VIR_FREE(logdir);
|
||||||
goto no_memory;
|
goto error;
|
||||||
}
|
}
|
||||||
VIR_FREE(logdir);
|
VIR_FREE(logdir);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (virAsprintf(&tmp, "%d:stderr", virLogGetDefaultPriority()) < 0)
|
if (virAsprintf(&tmp, "%d:stderr", virLogGetDefaultPriority()) < 0)
|
||||||
goto no_memory;
|
goto error;
|
||||||
}
|
}
|
||||||
virLogParseOutputs(tmp);
|
virLogParseOutputs(tmp);
|
||||||
VIR_FREE(tmp);
|
VIR_FREE(tmp);
|
||||||
@ -722,8 +718,6 @@ daemonSetupLogging(struct daemonConfig *config,
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
no_memory:
|
|
||||||
virReportOOMError();
|
|
||||||
error:
|
error:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1153,7 +1147,7 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
*tmp = '\0';
|
*tmp = '\0';
|
||||||
char *driverdir;
|
char *driverdir;
|
||||||
if (virAsprintf(&driverdir, "%s/../../src/.libs", argv[0]) < 0) {
|
if (virAsprintfQuiet(&driverdir, "%s/../../src/.libs", argv[0]) < 0) {
|
||||||
fprintf(stderr, _("%s: initialization failed\n"), argv[0]);
|
fprintf(stderr, _("%s: initialization failed\n"), argv[0]);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
234
daemon/remote.c
234
daemon/remote.c
@ -332,10 +332,8 @@ static int remoteRelayDomainEventGraphics(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
data.subject.subject_len = subject->nidentity;
|
data.subject.subject_len = subject->nidentity;
|
||||||
if (VIR_ALLOC_N(data.subject.subject_val, data.subject.subject_len) < 0) {
|
if (VIR_ALLOC_N(data.subject.subject_val, data.subject.subject_len) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < data.subject.subject_len; i++) {
|
for (i = 0; i < data.subject.subject_len; i++) {
|
||||||
if (VIR_STRDUP(data.subject.subject_val[i].type, subject->identities[i].type) < 0 ||
|
if (VIR_STRDUP(data.subject.subject_val[i].type, subject->identities[i].type) < 0 ||
|
||||||
@ -448,12 +446,12 @@ static int remoteRelayDomainEventDiskChange(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
if (oldSrcPath &&
|
if (oldSrcPath &&
|
||||||
((VIR_ALLOC(oldSrcPath_p) < 0) ||
|
((VIR_ALLOC(oldSrcPath_p) < 0) ||
|
||||||
VIR_STRDUP(*oldSrcPath_p, oldSrcPath) < 0))
|
VIR_STRDUP(*oldSrcPath_p, oldSrcPath) < 0))
|
||||||
goto mem_error;
|
goto error;
|
||||||
|
|
||||||
if (newSrcPath &&
|
if (newSrcPath &&
|
||||||
((VIR_ALLOC(newSrcPath_p) < 0) ||
|
((VIR_ALLOC(newSrcPath_p) < 0) ||
|
||||||
VIR_STRDUP(*newSrcPath_p, newSrcPath) < 0))
|
VIR_STRDUP(*newSrcPath_p, newSrcPath) < 0))
|
||||||
goto mem_error;
|
goto error;
|
||||||
|
|
||||||
data.oldSrcPath = oldSrcPath_p;
|
data.oldSrcPath = oldSrcPath_p;
|
||||||
data.newSrcPath = newSrcPath_p;
|
data.newSrcPath = newSrcPath_p;
|
||||||
@ -469,8 +467,6 @@ static int remoteRelayDomainEventDiskChange(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
mem_error:
|
|
||||||
virReportOOMError();
|
|
||||||
error:
|
error:
|
||||||
VIR_FREE(oldSrcPath_p);
|
VIR_FREE(oldSrcPath_p);
|
||||||
VIR_FREE(newSrcPath_p);
|
VIR_FREE(newSrcPath_p);
|
||||||
@ -670,14 +666,12 @@ void *remoteClientInitHook(virNetServerClientPtr client,
|
|||||||
struct daemonClientPrivate *priv;
|
struct daemonClientPrivate *priv;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (VIR_ALLOC(priv) < 0) {
|
if (VIR_ALLOC(priv) < 0)
|
||||||
virReportOOMError();
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
if (virMutexInit(&priv->lock) < 0) {
|
if (virMutexInit(&priv->lock) < 0) {
|
||||||
VIR_FREE(priv);
|
VIR_FREE(priv);
|
||||||
virReportOOMError();
|
virReportSystemError(errno, "%s", _("unable to init mutex"));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -807,10 +801,8 @@ remoteSerializeTypedParameters(virTypedParameterPtr params,
|
|||||||
remote_typed_param *val;
|
remote_typed_param *val;
|
||||||
|
|
||||||
*ret_params_len = nparams;
|
*ret_params_len = nparams;
|
||||||
if (VIR_ALLOC_N(val, nparams) < 0) {
|
if (VIR_ALLOC_N(val, nparams) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0, j = 0; i < nparams; ++i) {
|
for (i = 0, j = 0; i < nparams; ++i) {
|
||||||
/* virDomainGetCPUStats can return a sparse array; also, we
|
/* virDomainGetCPUStats can return a sparse array; also, we
|
||||||
@ -889,10 +881,8 @@ remoteDeserializeTypedParameters(remote_typed_param *args_params_val,
|
|||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (VIR_ALLOC_N(params, args_params_len) < 0) {
|
if (VIR_ALLOC_N(params, args_params_len) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
*nparams = args_params_len;
|
*nparams = args_params_len;
|
||||||
|
|
||||||
@ -978,7 +968,7 @@ remoteDispatchDomainGetSchedulerParameters(virNetServerPtr server ATTRIBUTE_UNUS
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0)
|
if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0)
|
||||||
goto no_memory;
|
goto cleanup;
|
||||||
nparams = args->nparams;
|
nparams = args->nparams;
|
||||||
|
|
||||||
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
|
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
|
||||||
@ -1002,10 +992,6 @@ cleanup:
|
|||||||
if (dom)
|
if (dom)
|
||||||
virDomainFree(dom);
|
virDomainFree(dom);
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
no_memory:
|
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1033,10 +1019,8 @@ remoteDispatchConnectListAllDomains(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (doms && ndomains) {
|
if (doms && ndomains) {
|
||||||
if (VIR_ALLOC_N(ret->domains.domains_val, ndomains) < 0) {
|
if (VIR_ALLOC_N(ret->domains.domains_val, ndomains) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
ret->domains.domains_len = ndomains;
|
ret->domains.domains_len = ndomains;
|
||||||
|
|
||||||
@ -1087,7 +1071,7 @@ remoteDispatchDomainGetSchedulerParametersFlags(virNetServerPtr server ATTRIBUTE
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0)
|
if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0)
|
||||||
goto no_memory;
|
goto cleanup;
|
||||||
nparams = args->nparams;
|
nparams = args->nparams;
|
||||||
|
|
||||||
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
|
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
|
||||||
@ -1112,10 +1096,6 @@ cleanup:
|
|||||||
if (dom)
|
if (dom)
|
||||||
virDomainFree(dom);
|
virDomainFree(dom);
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
no_memory:
|
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1148,20 +1128,16 @@ remoteDispatchDomainMemoryStats(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
/* Allocate stats array for making dispatch call */
|
/* Allocate stats array for making dispatch call */
|
||||||
if (VIR_ALLOC_N(stats, args->maxStats) < 0) {
|
if (VIR_ALLOC_N(stats, args->maxStats) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
nr_stats = virDomainMemoryStats(dom, stats, args->maxStats, args->flags);
|
nr_stats = virDomainMemoryStats(dom, stats, args->maxStats, args->flags);
|
||||||
if (nr_stats < 0)
|
if (nr_stats < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
/* Allocate return buffer */
|
/* Allocate return buffer */
|
||||||
if (VIR_ALLOC_N(ret->stats.stats_val, args->maxStats) < 0) {
|
if (VIR_ALLOC_N(ret->stats.stats_val, args->maxStats) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
/* Copy the stats into the xdr return structure */
|
/* Copy the stats into the xdr return structure */
|
||||||
for (i = 0; i < nr_stats; i++) {
|
for (i = 0; i < nr_stats; i++) {
|
||||||
@ -1216,10 +1192,8 @@ remoteDispatchDomainBlockPeek(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret->buffer.buffer_len = size;
|
ret->buffer.buffer_len = size;
|
||||||
if (VIR_ALLOC_N(ret->buffer.buffer_val, size) < 0) {
|
if (VIR_ALLOC_N(ret->buffer.buffer_val, size) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (virDomainBlockPeek(dom, path, offset, size,
|
if (virDomainBlockPeek(dom, path, offset, size,
|
||||||
ret->buffer.buffer_val, flags) < 0)
|
ret->buffer.buffer_val, flags) < 0)
|
||||||
@ -1267,10 +1241,8 @@ remoteDispatchDomainBlockStatsFlags(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0) {
|
if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
nparams = args->nparams;
|
nparams = args->nparams;
|
||||||
|
|
||||||
if (virDomainBlockStatsFlags(dom, path, params, &nparams, flags) < 0)
|
if (virDomainBlockStatsFlags(dom, path, params, &nparams, flags) < 0)
|
||||||
@ -1337,10 +1309,8 @@ remoteDispatchDomainMemoryPeek(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret->buffer.buffer_len = size;
|
ret->buffer.buffer_len = size;
|
||||||
if (VIR_ALLOC_N(ret->buffer.buffer_val, size) < 0) {
|
if (VIR_ALLOC_N(ret->buffer.buffer_val, size) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (virDomainMemoryPeek(dom, offset, size,
|
if (virDomainMemoryPeek(dom, offset, size,
|
||||||
ret->buffer.buffer_val, flags) < 0)
|
ret->buffer.buffer_val, flags) < 0)
|
||||||
@ -1380,19 +1350,15 @@ remoteDispatchDomainGetSecurityLabel(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
|
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (VIR_ALLOC(seclabel) < 0) {
|
if (VIR_ALLOC(seclabel) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (virDomainGetSecurityLabel(dom, seclabel) < 0)
|
if (virDomainGetSecurityLabel(dom, seclabel) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret->label.label_len = strlen(seclabel->label) + 1;
|
ret->label.label_len = strlen(seclabel->label) + 1;
|
||||||
if (VIR_ALLOC_N(ret->label.label_val, ret->label.label_len) < 0) {
|
if (VIR_ALLOC_N(ret->label.label_val, ret->label.label_len) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
strcpy(ret->label.label_val, seclabel->label);
|
strcpy(ret->label.label_val, seclabel->label);
|
||||||
ret->enforcing = seclabel->enforcing;
|
ret->enforcing = seclabel->enforcing;
|
||||||
|
|
||||||
@ -1436,18 +1402,14 @@ remoteDispatchDomainGetSecurityLabelList(virNetServerPtr server ATTRIBUTE_UNUSED
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VIR_ALLOC_N(ret->labels.labels_val, len) < 0) {
|
if (VIR_ALLOC_N(ret->labels.labels_val, len) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
size_t label_len = strlen(seclabels[i].label) + 1;
|
size_t label_len = strlen(seclabels[i].label) + 1;
|
||||||
remote_domain_get_security_label_ret *cur = &ret->labels.labels_val[i];
|
remote_domain_get_security_label_ret *cur = &ret->labels.labels_val[i];
|
||||||
if (VIR_ALLOC_N(cur->label.label_val, label_len) < 0) {
|
if (VIR_ALLOC_N(cur->label.label_val, label_len) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
if (virStrcpy(cur->label.label_val, seclabels[i].label, label_len) == NULL) {
|
if (virStrcpy(cur->label.label_val, seclabels[i].label, label_len) == NULL) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("failed to copy security label"));
|
_("failed to copy security label"));
|
||||||
@ -1492,17 +1454,13 @@ remoteDispatchNodeGetSecurityModel(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret->model.model_len = strlen(secmodel.model) + 1;
|
ret->model.model_len = strlen(secmodel.model) + 1;
|
||||||
if (VIR_ALLOC_N(ret->model.model_val, ret->model.model_len) < 0) {
|
if (VIR_ALLOC_N(ret->model.model_val, ret->model.model_len) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
strcpy(ret->model.model_val, secmodel.model);
|
strcpy(ret->model.model_val, secmodel.model);
|
||||||
|
|
||||||
ret->doi.doi_len = strlen(secmodel.doi) + 1;
|
ret->doi.doi_len = strlen(secmodel.doi) + 1;
|
||||||
if (VIR_ALLOC_N(ret->doi.doi_val, ret->doi.doi_len) < 0) {
|
if (VIR_ALLOC_N(ret->doi.doi_val, ret->doi.doi_len) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
strcpy(ret->doi.doi_val, secmodel.doi);
|
strcpy(ret->doi.doi_val, secmodel.doi);
|
||||||
|
|
||||||
rv = 0;
|
rv = 0;
|
||||||
@ -1550,7 +1508,7 @@ remoteDispatchDomainGetVcpuPinInfo(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
/* Allocate buffers to take the results. */
|
/* Allocate buffers to take the results. */
|
||||||
if (args->maplen > 0 &&
|
if (args->maplen > 0 &&
|
||||||
VIR_ALLOC_N(cpumaps, args->ncpumaps * args->maplen) < 0)
|
VIR_ALLOC_N(cpumaps, args->ncpumaps * args->maplen) < 0)
|
||||||
goto no_memory;
|
goto cleanup;
|
||||||
|
|
||||||
if ((num = virDomainGetVcpuPinInfo(dom,
|
if ((num = virDomainGetVcpuPinInfo(dom,
|
||||||
args->ncpumaps,
|
args->ncpumaps,
|
||||||
@ -1577,10 +1535,6 @@ cleanup:
|
|||||||
if (dom)
|
if (dom)
|
||||||
virDomainFree(dom);
|
virDomainFree(dom);
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
no_memory:
|
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1646,7 +1600,7 @@ remoteDispatchDomainGetEmulatorPinInfo(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
/* Allocate buffers to take the results */
|
/* Allocate buffers to take the results */
|
||||||
if (args->maplen > 0 &&
|
if (args->maplen > 0 &&
|
||||||
VIR_ALLOC_N(cpumaps, args->maplen) < 0)
|
VIR_ALLOC_N(cpumaps, args->maplen) < 0)
|
||||||
goto no_memory;
|
goto cleanup;
|
||||||
|
|
||||||
if ((r = virDomainGetEmulatorPinInfo(dom,
|
if ((r = virDomainGetEmulatorPinInfo(dom,
|
||||||
cpumaps,
|
cpumaps,
|
||||||
@ -1668,10 +1622,6 @@ cleanup:
|
|||||||
if (dom)
|
if (dom)
|
||||||
virDomainFree(dom);
|
virDomainFree(dom);
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
no_memory:
|
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1711,10 +1661,10 @@ remoteDispatchDomainGetVcpus(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
|
|
||||||
/* Allocate buffers to take the results. */
|
/* Allocate buffers to take the results. */
|
||||||
if (VIR_ALLOC_N(info, args->maxinfo) < 0)
|
if (VIR_ALLOC_N(info, args->maxinfo) < 0)
|
||||||
goto no_memory;
|
goto cleanup;
|
||||||
if (args->maplen > 0 &&
|
if (args->maplen > 0 &&
|
||||||
VIR_ALLOC_N(cpumaps, args->maxinfo * args->maplen) < 0)
|
VIR_ALLOC_N(cpumaps, args->maxinfo * args->maplen) < 0)
|
||||||
goto no_memory;
|
goto cleanup;
|
||||||
|
|
||||||
if ((info_len = virDomainGetVcpus(dom,
|
if ((info_len = virDomainGetVcpus(dom,
|
||||||
info, args->maxinfo,
|
info, args->maxinfo,
|
||||||
@ -1724,7 +1674,7 @@ remoteDispatchDomainGetVcpus(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
/* Allocate the return buffer for info. */
|
/* Allocate the return buffer for info. */
|
||||||
ret->info.info_len = info_len;
|
ret->info.info_len = info_len;
|
||||||
if (VIR_ALLOC_N(ret->info.info_val, info_len) < 0)
|
if (VIR_ALLOC_N(ret->info.info_val, info_len) < 0)
|
||||||
goto no_memory;
|
goto cleanup;
|
||||||
|
|
||||||
for (i = 0; i < info_len; ++i) {
|
for (i = 0; i < info_len; ++i) {
|
||||||
ret->info.info_val[i].number = info[i].number;
|
ret->info.info_val[i].number = info[i].number;
|
||||||
@ -1753,10 +1703,6 @@ cleanup:
|
|||||||
if (dom)
|
if (dom)
|
||||||
virDomainFree(dom);
|
virDomainFree(dom);
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
no_memory:
|
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1785,10 +1731,8 @@ remoteDispatchDomainMigratePrepare(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
dname = args->dname == NULL ? NULL : *args->dname;
|
dname = args->dname == NULL ? NULL : *args->dname;
|
||||||
|
|
||||||
/* Wacky world of XDR ... */
|
/* Wacky world of XDR ... */
|
||||||
if (VIR_ALLOC(uri_out) < 0) {
|
if (VIR_ALLOC(uri_out) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (virDomainMigratePrepare(priv->conn, &cookie, &cookielen,
|
if (virDomainMigratePrepare(priv->conn, &cookie, &cookielen,
|
||||||
uri_in, uri_out,
|
uri_in, uri_out,
|
||||||
@ -1842,10 +1786,8 @@ remoteDispatchDomainMigratePrepare2(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
dname = args->dname == NULL ? NULL : *args->dname;
|
dname = args->dname == NULL ? NULL : *args->dname;
|
||||||
|
|
||||||
/* Wacky world of XDR ... */
|
/* Wacky world of XDR ... */
|
||||||
if (VIR_ALLOC(uri_out) < 0) {
|
if (VIR_ALLOC(uri_out) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (virDomainMigratePrepare2(priv->conn, &cookie, &cookielen,
|
if (virDomainMigratePrepare2(priv->conn, &cookie, &cookielen,
|
||||||
uri_in, uri_out,
|
uri_in, uri_out,
|
||||||
@ -1895,10 +1837,8 @@ remoteDispatchDomainGetMemoryParameters(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0) {
|
if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
nparams = args->nparams;
|
nparams = args->nparams;
|
||||||
|
|
||||||
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
|
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
|
||||||
@ -1960,10 +1900,8 @@ remoteDispatchDomainGetNumaParameters(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0) {
|
if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
nparams = args->nparams;
|
nparams = args->nparams;
|
||||||
|
|
||||||
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
|
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
|
||||||
@ -2025,10 +1963,8 @@ remoteDispatchDomainGetBlkioParameters(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0) {
|
if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
nparams = args->nparams;
|
nparams = args->nparams;
|
||||||
|
|
||||||
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
|
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
|
||||||
@ -2091,10 +2027,8 @@ remoteDispatchNodeGetCPUStats(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0) {
|
if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
nparams = args->nparams;
|
nparams = args->nparams;
|
||||||
|
|
||||||
if (virNodeGetCPUStats(priv->conn, cpuNum, params, &nparams, flags) < 0)
|
if (virNodeGetCPUStats(priv->conn, cpuNum, params, &nparams, flags) < 0)
|
||||||
@ -2111,7 +2045,7 @@ remoteDispatchNodeGetCPUStats(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
/* Serialise the memory parameters. */
|
/* Serialise the memory parameters. */
|
||||||
ret->params.params_len = nparams;
|
ret->params.params_len = nparams;
|
||||||
if (VIR_ALLOC_N(ret->params.params_val, nparams) < 0)
|
if (VIR_ALLOC_N(ret->params.params_val, nparams) < 0)
|
||||||
goto no_memory;
|
goto cleanup;
|
||||||
|
|
||||||
for (i = 0; i < nparams; ++i) {
|
for (i = 0; i < nparams; ++i) {
|
||||||
/* remoteDispatchClientRequest will free this: */
|
/* remoteDispatchClientRequest will free this: */
|
||||||
@ -2135,10 +2069,6 @@ cleanup:
|
|||||||
}
|
}
|
||||||
VIR_FREE(params);
|
VIR_FREE(params);
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
no_memory:
|
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -2169,10 +2099,8 @@ remoteDispatchNodeGetMemoryStats(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0) {
|
if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
nparams = args->nparams;
|
nparams = args->nparams;
|
||||||
|
|
||||||
if (virNodeGetMemoryStats(priv->conn, cellNum, params, &nparams, flags) < 0)
|
if (virNodeGetMemoryStats(priv->conn, cellNum, params, &nparams, flags) < 0)
|
||||||
@ -2189,7 +2117,7 @@ remoteDispatchNodeGetMemoryStats(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
/* Serialise the memory parameters. */
|
/* Serialise the memory parameters. */
|
||||||
ret->params.params_len = nparams;
|
ret->params.params_len = nparams;
|
||||||
if (VIR_ALLOC_N(ret->params.params_val, nparams) < 0)
|
if (VIR_ALLOC_N(ret->params.params_val, nparams) < 0)
|
||||||
goto no_memory;
|
goto cleanup;
|
||||||
|
|
||||||
for (i = 0; i < nparams; ++i) {
|
for (i = 0; i < nparams; ++i) {
|
||||||
/* remoteDispatchClientRequest will free this: */
|
/* remoteDispatchClientRequest will free this: */
|
||||||
@ -2213,10 +2141,6 @@ cleanup:
|
|||||||
}
|
}
|
||||||
VIR_FREE(params);
|
VIR_FREE(params);
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
no_memory:
|
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -2285,10 +2209,8 @@ remoteDispatchDomainGetBlockIoTune(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0) {
|
if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
nparams = args->nparams;
|
nparams = args->nparams;
|
||||||
|
|
||||||
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
|
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
|
||||||
@ -2354,10 +2276,8 @@ remoteDispatchAuthList(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
} else if (callerUid == 0) {
|
} else if (callerUid == 0) {
|
||||||
char *ident;
|
char *ident;
|
||||||
if (virAsprintf(&ident, "pid:%lld,uid:%d",
|
if (virAsprintf(&ident, "pid:%lld,uid:%d",
|
||||||
(long long) callerPid, (int) callerUid) < 0) {
|
(long long) callerPid, (int) callerUid) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
VIR_INFO("Bypass polkit auth for privileged client %s", ident);
|
VIR_INFO("Bypass polkit auth for privileged client %s", ident);
|
||||||
virNetServerClientSetAuth(client, 0);
|
virNetServerClientSetAuth(client, 0);
|
||||||
auth = VIR_NET_SERVER_SERVICE_AUTH_NONE;
|
auth = VIR_NET_SERVER_SERVICE_AUTH_NONE;
|
||||||
@ -2366,10 +2286,8 @@ remoteDispatchAuthList(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret->types.types_len = 1;
|
ret->types.types_len = 1;
|
||||||
if (VIR_ALLOC_N(ret->types.types_val, ret->types.types_len) < 0) {
|
if (VIR_ALLOC_N(ret->types.types_val, ret->types.types_len) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
switch (auth) {
|
switch (auth) {
|
||||||
case VIR_NET_SERVER_SERVICE_AUTH_NONE:
|
case VIR_NET_SERVER_SERVICE_AUTH_NONE:
|
||||||
@ -2815,10 +2733,8 @@ remoteDispatchAuthPolkit(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
virCommandAddArg(cmd, "--allow-user-interaction");
|
virCommandAddArg(cmd, "--allow-user-interaction");
|
||||||
|
|
||||||
if (virAsprintf(&ident, "pid:%lld,uid:%d",
|
if (virAsprintf(&ident, "pid:%lld,uid:%d",
|
||||||
(long long) callerPid, callerUid) < 0) {
|
(long long) callerPid, callerUid) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto authfail;
|
goto authfail;
|
||||||
}
|
|
||||||
|
|
||||||
if (virCommandRun(cmd, &status) < 0)
|
if (virCommandRun(cmd, &status) < 0)
|
||||||
goto authfail;
|
goto authfail;
|
||||||
@ -2920,10 +2836,8 @@ remoteDispatchAuthPolkit(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (virAsprintf(&ident, "pid:%lld,uid:%d",
|
if (virAsprintf(&ident, "pid:%lld,uid:%d",
|
||||||
(long long) callerPid, callerUid) < 0) {
|
(long long) callerPid, callerUid) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto authfail;
|
goto authfail;
|
||||||
}
|
|
||||||
|
|
||||||
if (!(sysbus = virDBusGetSystemBus()))
|
if (!(sysbus = virDBusGetSystemBus()))
|
||||||
goto authfail;
|
goto authfail;
|
||||||
@ -3073,10 +2987,8 @@ remoteDispatchNodeDeviceGetParent(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
} else {
|
} else {
|
||||||
/* remoteDispatchClientRequest will free this. */
|
/* remoteDispatchClientRequest will free this. */
|
||||||
char **parent_p;
|
char **parent_p;
|
||||||
if (VIR_ALLOC(parent_p) < 0) {
|
if (VIR_ALLOC(parent_p) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
if (VIR_STRDUP(*parent_p, parent) < 0) {
|
if (VIR_STRDUP(*parent_p, parent) < 0) {
|
||||||
VIR_FREE(parent_p);
|
VIR_FREE(parent_p);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -3495,10 +3407,8 @@ remoteDispatchDomainMigratePrepare3(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
dname = args->dname == NULL ? NULL : *args->dname;
|
dname = args->dname == NULL ? NULL : *args->dname;
|
||||||
|
|
||||||
/* Wacky world of XDR ... */
|
/* Wacky world of XDR ... */
|
||||||
if (VIR_ALLOC(uri_out) < 0) {
|
if (VIR_ALLOC(uri_out) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (virDomainMigratePrepare3(priv->conn,
|
if (virDomainMigratePrepare3(priv->conn,
|
||||||
args->cookie_in.cookie_in_val,
|
args->cookie_in.cookie_in_val,
|
||||||
@ -3792,10 +3702,8 @@ remoteDispatchDomainGetInterfaceParameters(virNetServerPtr server ATTRIBUTE_UNUS
|
|||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0) {
|
if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
nparams = args->nparams;
|
nparams = args->nparams;
|
||||||
|
|
||||||
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
|
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
|
||||||
@ -3860,10 +3768,8 @@ remoteDispatchDomainGetCPUStats(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (args->nparams > 0 &&
|
if (args->nparams > 0 &&
|
||||||
VIR_ALLOC_N(params, args->ncpus * args->nparams) < 0) {
|
VIR_ALLOC_N(params, args->ncpus * args->nparams) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
|
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -3934,10 +3840,8 @@ static int remoteDispatchDomainGetDiskErrors(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (args->maxerrors &&
|
if (args->maxerrors &&
|
||||||
VIR_ALLOC_N(errors, args->maxerrors) < 0) {
|
VIR_ALLOC_N(errors, args->maxerrors) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if ((len = virDomainGetDiskErrors(dom, errors,
|
if ((len = virDomainGetDiskErrors(dom, errors,
|
||||||
args->maxerrors,
|
args->maxerrors,
|
||||||
@ -3996,10 +3900,8 @@ remoteDispatchDomainListAllSnapshots(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (snaps && nsnaps) {
|
if (snaps && nsnaps) {
|
||||||
if (VIR_ALLOC_N(ret->snapshots.snapshots_val, nsnaps) < 0) {
|
if (VIR_ALLOC_N(ret->snapshots.snapshots_val, nsnaps) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
ret->snapshots.snapshots_len = nsnaps;
|
ret->snapshots.snapshots_len = nsnaps;
|
||||||
|
|
||||||
@ -4060,10 +3962,8 @@ remoteDispatchDomainSnapshotListAllChildren(virNetServerPtr server ATTRIBUTE_UNU
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (snaps && nsnaps) {
|
if (snaps && nsnaps) {
|
||||||
if (VIR_ALLOC_N(ret->snapshots.snapshots_val, nsnaps) < 0) {
|
if (VIR_ALLOC_N(ret->snapshots.snapshots_val, nsnaps) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
ret->snapshots.snapshots_len = nsnaps;
|
ret->snapshots.snapshots_len = nsnaps;
|
||||||
|
|
||||||
@ -4118,10 +4018,8 @@ remoteDispatchConnectListAllStoragePools(virNetServerPtr server ATTRIBUTE_UNUSED
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (pools && npools) {
|
if (pools && npools) {
|
||||||
if (VIR_ALLOC_N(ret->pools.pools_val, npools) < 0) {
|
if (VIR_ALLOC_N(ret->pools.pools_val, npools) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
ret->pools.pools_len = npools;
|
ret->pools.pools_len = npools;
|
||||||
|
|
||||||
@ -4176,10 +4074,8 @@ remoteDispatchStoragePoolListAllVolumes(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (vols && nvols) {
|
if (vols && nvols) {
|
||||||
if (VIR_ALLOC_N(ret->vols.vols_val, nvols) < 0) {
|
if (VIR_ALLOC_N(ret->vols.vols_val, nvols) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
ret->vols.vols_len = nvols;
|
ret->vols.vols_len = nvols;
|
||||||
|
|
||||||
@ -4232,10 +4128,8 @@ remoteDispatchConnectListAllNetworks(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (nets && nnets) {
|
if (nets && nnets) {
|
||||||
if (VIR_ALLOC_N(ret->nets.nets_val, nnets) < 0) {
|
if (VIR_ALLOC_N(ret->nets.nets_val, nnets) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
ret->nets.nets_len = nnets;
|
ret->nets.nets_len = nnets;
|
||||||
|
|
||||||
@ -4286,10 +4180,8 @@ remoteDispatchConnectListAllInterfaces(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (ifaces && nifaces) {
|
if (ifaces && nifaces) {
|
||||||
if (VIR_ALLOC_N(ret->ifaces.ifaces_val, nifaces) < 0) {
|
if (VIR_ALLOC_N(ret->ifaces.ifaces_val, nifaces) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
ret->ifaces.ifaces_len = nifaces;
|
ret->ifaces.ifaces_len = nifaces;
|
||||||
|
|
||||||
@ -4340,10 +4232,8 @@ remoteDispatchConnectListAllNodeDevices(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (devices && ndevices) {
|
if (devices && ndevices) {
|
||||||
if (VIR_ALLOC_N(ret->devices.devices_val, ndevices) < 0) {
|
if (VIR_ALLOC_N(ret->devices.devices_val, ndevices) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
ret->devices.devices_len = ndevices;
|
ret->devices.devices_len = ndevices;
|
||||||
|
|
||||||
@ -4394,10 +4284,8 @@ remoteDispatchConnectListAllNWFilters(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (filters && nfilters) {
|
if (filters && nfilters) {
|
||||||
if (VIR_ALLOC_N(ret->filters.filters_val, nfilters) < 0) {
|
if (VIR_ALLOC_N(ret->filters.filters_val, nfilters) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
ret->filters.filters_len = nfilters;
|
ret->filters.filters_len = nfilters;
|
||||||
|
|
||||||
@ -4448,10 +4336,8 @@ remoteDispatchConnectListAllSecrets(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (secrets && nsecrets) {
|
if (secrets && nsecrets) {
|
||||||
if (VIR_ALLOC_N(ret->secrets.secrets_val, nsecrets) < 0) {
|
if (VIR_ALLOC_N(ret->secrets.secrets_val, nsecrets) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
ret->secrets.secrets_len = nsecrets;
|
ret->secrets.secrets_len = nsecrets;
|
||||||
|
|
||||||
@ -4503,10 +4389,8 @@ remoteDispatchNodeGetMemoryParameters(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0) {
|
if (args->nparams && VIR_ALLOC_N(params, args->nparams) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
nparams = args->nparams;
|
nparams = args->nparams;
|
||||||
|
|
||||||
if (virNodeGetMemoryParameters(priv->conn, params, &nparams, flags) < 0)
|
if (virNodeGetMemoryParameters(priv->conn, params, &nparams, flags) < 0)
|
||||||
@ -4758,10 +4642,8 @@ remoteDispatchDomainMigratePrepare3Params(
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
/* Wacky world of XDR ... */
|
/* Wacky world of XDR ... */
|
||||||
if (VIR_ALLOC(uri_out) < 0) {
|
if (VIR_ALLOC(uri_out) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (virDomainMigratePrepare3Params(priv->conn, params, nparams,
|
if (virDomainMigratePrepare3Params(priv->conn, params, nparams,
|
||||||
args->cookie_in.cookie_in_val,
|
args->cookie_in.cookie_in_val,
|
||||||
@ -5148,10 +5030,8 @@ remoteSerializeDomainDiskErrors(virDomainDiskErrorPtr errors,
|
|||||||
remote_domain_disk_error *val = NULL;
|
remote_domain_disk_error *val = NULL;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
if (VIR_ALLOC_N(val, nerrors) < 0) {
|
if (VIR_ALLOC_N(val, nerrors) < 0)
|
||||||
virReportOOMError();
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < nerrors; i++) {
|
for (i = 0; i < nerrors; i++) {
|
||||||
if (VIR_STRDUP(val[i].disk, errors[i].disk) < 0)
|
if (VIR_STRDUP(val[i].disk, errors[i].disk) < 0)
|
||||||
|
@ -325,10 +325,8 @@ daemonCreateClientStream(virNetServerClientPtr client,
|
|||||||
VIR_DEBUG("client=%p, proc=%d, serial=%d, st=%p",
|
VIR_DEBUG("client=%p, proc=%d, serial=%d, st=%p",
|
||||||
client, header->proc, header->serial, st);
|
client, header->proc, header->serial, st);
|
||||||
|
|
||||||
if (VIR_ALLOC(stream) < 0) {
|
if (VIR_ALLOC(stream) < 0)
|
||||||
virReportOOMError();
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
stream->refs = 1;
|
stream->refs = 1;
|
||||||
stream->priv = priv;
|
stream->priv = priv;
|
||||||
|
Loading…
Reference in New Issue
Block a user