mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
Do not check return value of VIR_RESIZE_N
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
be664a41f9
commit
244204eccd
@ -154,10 +154,7 @@ virBhyveDomainCapsBuild(bhyveConnPtr conn,
|
||||
|
||||
if (virDirOpenIfExists(&dir, firmware_dir) > 0) {
|
||||
while ((virDirRead(dir, &entry, firmware_dir)) > 0) {
|
||||
if (VIR_RESIZE_N(firmwares->values,
|
||||
firmwares_alloc, firmwares->nvalues, 1) < 0)
|
||||
goto cleanup;
|
||||
|
||||
VIR_RESIZE_N(firmwares->values, firmwares_alloc, firmwares->nvalues, 1);
|
||||
firmwares->values[firmwares->nvalues] = g_strdup_printf("%s/%s",
|
||||
firmware_dir, entry->d_name);
|
||||
firmwares->nvalues++;
|
||||
|
@ -153,10 +153,7 @@ bhyveCommandLineToArgv(const char *nativeConfig,
|
||||
else
|
||||
line = g_strdup(curr);
|
||||
|
||||
if (VIR_RESIZE_N(lines, lines_alloc, line_count, 2) < 0) {
|
||||
VIR_FREE(line);
|
||||
goto error;
|
||||
}
|
||||
VIR_RESIZE_N(lines, lines_alloc, line_count, 2);
|
||||
|
||||
if (*line)
|
||||
lines[line_count++] = line;
|
||||
@ -203,11 +200,7 @@ bhyveCommandLineToArgv(const char *nativeConfig,
|
||||
if (next && (*next == '\'' || *next == '"'))
|
||||
next++;
|
||||
|
||||
if (VIR_RESIZE_N(arglist, args_alloc, args_count, 2) < 0) {
|
||||
VIR_FREE(arg);
|
||||
goto error;
|
||||
}
|
||||
|
||||
VIR_RESIZE_N(arglist, args_alloc, args_count, 2);
|
||||
arglist[args_count++] = arg;
|
||||
arglist[args_count] = NULL;
|
||||
|
||||
|
@ -280,10 +280,8 @@ int
|
||||
virCapabilitiesAddHostFeature(virCapsPtr caps,
|
||||
const char *name)
|
||||
{
|
||||
if (VIR_RESIZE_N(caps->host.features, caps->host.nfeatures_max,
|
||||
caps->host.nfeatures, 1) < 0)
|
||||
return -1;
|
||||
|
||||
VIR_RESIZE_N(caps->host.features, caps->host.nfeatures_max,
|
||||
caps->host.nfeatures, 1);
|
||||
caps->host.features[caps->host.nfeatures] = g_strdup(name);
|
||||
caps->host.nfeatures++;
|
||||
|
||||
@ -301,10 +299,8 @@ int
|
||||
virCapabilitiesAddHostMigrateTransport(virCapsPtr caps,
|
||||
const char *name)
|
||||
{
|
||||
if (VIR_RESIZE_N(caps->host.migrateTrans, caps->host.nmigrateTrans_max,
|
||||
caps->host.nmigrateTrans, 1) < 0)
|
||||
return -1;
|
||||
|
||||
VIR_RESIZE_N(caps->host.migrateTrans, caps->host.nmigrateTrans_max,
|
||||
caps->host.nmigrateTrans, 1);
|
||||
caps->host.migrateTrans[caps->host.nmigrateTrans] = g_strdup(name);
|
||||
caps->host.nmigrateTrans++;
|
||||
|
||||
@ -447,9 +443,7 @@ virCapabilitiesAddGuest(virCapsPtr caps,
|
||||
guest->arch.defaultInfo.emulator = g_strdup(emulator);
|
||||
guest->arch.defaultInfo.loader = g_strdup(loader);
|
||||
|
||||
if (VIR_RESIZE_N(caps->guests, caps->nguests_max,
|
||||
caps->nguests, 1) < 0)
|
||||
goto error;
|
||||
VIR_RESIZE_N(caps->guests, caps->nguests_max, caps->nguests, 1);
|
||||
caps->guests[caps->nguests++] = guest;
|
||||
|
||||
if (nmachines) {
|
||||
@ -458,10 +452,6 @@ virCapabilitiesAddGuest(virCapsPtr caps,
|
||||
}
|
||||
|
||||
return guest;
|
||||
|
||||
error:
|
||||
virCapabilitiesFreeGuest(guest);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -493,9 +483,8 @@ virCapabilitiesAddGuestDomain(virCapsGuestPtr guest,
|
||||
dom->info.emulator = g_strdup(emulator);
|
||||
dom->info.loader = g_strdup(loader);
|
||||
|
||||
if (VIR_RESIZE_N(guest->arch.domains, guest->arch.ndomains_max,
|
||||
guest->arch.ndomains, 1) < 0)
|
||||
goto error;
|
||||
VIR_RESIZE_N(guest->arch.domains, guest->arch.ndomains_max,
|
||||
guest->arch.ndomains, 1);
|
||||
guest->arch.domains[guest->arch.ndomains] = dom;
|
||||
guest->arch.ndomains++;
|
||||
|
||||
@ -505,10 +494,6 @@ virCapabilitiesAddGuestDomain(virCapsGuestPtr guest,
|
||||
}
|
||||
|
||||
return dom;
|
||||
|
||||
error:
|
||||
virCapabilitiesFreeGuestDomain(dom);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -803,15 +788,10 @@ virCapabilitiesAddStoragePool(virCapsPtr caps,
|
||||
|
||||
pool->type = poolType;
|
||||
|
||||
if (VIR_RESIZE_N(caps->pools, caps->npools_max, caps->npools, 1) < 0)
|
||||
goto error;
|
||||
VIR_RESIZE_N(caps->pools, caps->npools_max, caps->npools, 1);
|
||||
caps->pools[caps->npools++] = pool;
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
virCapabilitiesFreeStoragePool(pool);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -593,10 +593,7 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (VIR_RESIZE_N(def->features, def->nfeatures_max,
|
||||
def->nfeatures, n) < 0)
|
||||
return -1;
|
||||
|
||||
VIR_RESIZE_N(def->features, def->nfeatures_max, def->nfeatures, n);
|
||||
def->nfeatures = n;
|
||||
}
|
||||
|
||||
@ -898,12 +895,8 @@ virCPUDefAddFeatureInternal(virCPUDefPtr def,
|
||||
}
|
||||
}
|
||||
|
||||
if (VIR_RESIZE_N(def->features, def->nfeatures_max,
|
||||
def->nfeatures, 1) < 0)
|
||||
return -1;
|
||||
|
||||
VIR_RESIZE_N(def->features, def->nfeatures_max, def->nfeatures, 1);
|
||||
def->features[def->nfeatures].name = g_strdup(name);
|
||||
|
||||
def->features[def->nfeatures].policy = policy;
|
||||
def->nfeatures++;
|
||||
|
||||
|
@ -191,9 +191,8 @@ virDomainCapsCPUModelsAdd(virDomainCapsCPUModelsPtr cpuModels,
|
||||
|
||||
nameCopy = g_strdup(name);
|
||||
|
||||
if (VIR_RESIZE_N(cpuModels->models, cpuModels->nmodels_max,
|
||||
cpuModels->nmodels, 1) < 0)
|
||||
return -1;
|
||||
VIR_RESIZE_N(cpuModels->models, cpuModels->nmodels_max,
|
||||
cpuModels->nmodels, 1);
|
||||
|
||||
cpu = cpuModels->models + cpuModels->nmodels;
|
||||
cpuModels->nmodels++;
|
||||
|
@ -4917,8 +4917,7 @@ esxConnectListAllDomains(virConnectPtr conn,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (VIR_RESIZE_N(doms, ndoms, count, 2) < 0)
|
||||
goto cleanup;
|
||||
VIR_RESIZE_N(doms, ndoms, count, 2);
|
||||
|
||||
/* Only running/suspended virtual machines have an ID != -1 */
|
||||
if (powerState == esxVI_VirtualMachinePowerState_PoweredOff)
|
||||
|
@ -3524,8 +3524,7 @@ hypervConnectListAllDomains(virConnectPtr conn,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (VIR_RESIZE_N(doms, ndoms, count, 2) < 0)
|
||||
goto cleanup;
|
||||
VIR_RESIZE_N(doms, ndoms, count, 2);
|
||||
|
||||
domain = NULL;
|
||||
|
||||
|
@ -4287,10 +4287,8 @@ qemuDomainDefCPUPostParse(virDomainDefPtr def,
|
||||
sveFeature->policy = VIR_CPU_FEATURE_REQUIRE;
|
||||
}
|
||||
} else {
|
||||
if (VIR_RESIZE_N(def->cpu->features, def->cpu->nfeatures_max,
|
||||
def->cpu->nfeatures, 1) < 0) {
|
||||
return -1;
|
||||
}
|
||||
VIR_RESIZE_N(def->cpu->features, def->cpu->nfeatures_max,
|
||||
def->cpu->nfeatures, 1);
|
||||
|
||||
def->cpu->features[def->cpu->nfeatures].name = g_strdup("sve");
|
||||
def->cpu->features[def->cpu->nfeatures].policy = VIR_CPU_FEATURE_REQUIRE;
|
||||
@ -7340,10 +7338,9 @@ qemuDomainCleanupAdd(virDomainObjPtr vm,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (VIR_RESIZE_N(priv->cleanupCallbacks,
|
||||
priv->ncleanupCallbacks_max,
|
||||
priv->ncleanupCallbacks, 1) < 0)
|
||||
return -1;
|
||||
VIR_RESIZE_N(priv->cleanupCallbacks,
|
||||
priv->ncleanupCallbacks_max,
|
||||
priv->ncleanupCallbacks, 1);
|
||||
|
||||
priv->cleanupCallbacks[priv->ncleanupCallbacks++] = cb;
|
||||
return 0;
|
||||
|
@ -139,9 +139,8 @@ virBitmapExpand(virBitmapPtr map,
|
||||
|
||||
/* resize the memory if necessary */
|
||||
if (map->map_len < new_len) {
|
||||
if (VIR_RESIZE_N(map->map, map->map_alloc, map->map_len,
|
||||
new_len - map->map_len) < 0)
|
||||
return -1;
|
||||
VIR_RESIZE_N(map->map, map->map_alloc, map->map_len,
|
||||
new_len - map->map_len);
|
||||
}
|
||||
|
||||
map->nbits = b + 1;
|
||||
|
@ -1358,7 +1358,7 @@ virCommandAddEnv(virCommandPtr cmd,
|
||||
}
|
||||
|
||||
/* Arg plus trailing NULL. */
|
||||
ignore_value(VIR_RESIZE_N(cmd->env, cmd->maxenv, cmd->nenv, 1 + 1));
|
||||
VIR_RESIZE_N(cmd->env, cmd->maxenv, cmd->nenv, 1 + 1);
|
||||
|
||||
cmd->env[cmd->nenv++] = g_steal_pointer(&env);
|
||||
}
|
||||
@ -1459,7 +1459,7 @@ virCommandAddEnvPassCommon(virCommandPtr cmd)
|
||||
if (virCommandHasError(cmd))
|
||||
return;
|
||||
|
||||
ignore_value(VIR_RESIZE_N(cmd->env, cmd->maxenv, cmd->nenv, 9));
|
||||
VIR_RESIZE_N(cmd->env, cmd->maxenv, cmd->nenv, 9);
|
||||
|
||||
virCommandAddEnvPair(cmd, "LC_ALL", "C");
|
||||
|
||||
@ -1479,7 +1479,7 @@ virCommandAddEnvXDG(virCommandPtr cmd, const char *baseDir)
|
||||
if (virCommandHasError(cmd))
|
||||
return;
|
||||
|
||||
ignore_value(VIR_RESIZE_N(cmd->env, cmd->maxenv, cmd->nenv, 3));
|
||||
VIR_RESIZE_N(cmd->env, cmd->maxenv, cmd->nenv, 3);
|
||||
|
||||
virCommandAddEnvFormat(cmd, "XDG_DATA_HOME=%s/%s",
|
||||
baseDir, ".local/share");
|
||||
@ -1509,7 +1509,7 @@ virCommandAddArg(virCommandPtr cmd, const char *val)
|
||||
}
|
||||
|
||||
/* Arg plus trailing NULL. */
|
||||
ignore_value(VIR_RESIZE_N(cmd->args, cmd->maxargs, cmd->nargs, 1 + 1));
|
||||
VIR_RESIZE_N(cmd->args, cmd->maxargs, cmd->nargs, 1 + 1);
|
||||
|
||||
cmd->args[cmd->nargs++] = g_strdup(val);
|
||||
}
|
||||
@ -1535,7 +1535,7 @@ virCommandAddArgBuffer(virCommandPtr cmd, virBufferPtr buf)
|
||||
str = g_strdup("");
|
||||
|
||||
/* Arg plus trailing NULL. */
|
||||
ignore_value(VIR_RESIZE_N(cmd->args, cmd->maxargs, cmd->nargs, 1 + 1));
|
||||
VIR_RESIZE_N(cmd->args, cmd->maxargs, cmd->nargs, 1 + 1);
|
||||
|
||||
cmd->args[cmd->nargs] = g_steal_pointer(&str);
|
||||
cmd->nargs++;
|
||||
@ -1564,7 +1564,7 @@ virCommandAddArgFormat(virCommandPtr cmd, const char *format, ...)
|
||||
va_end(list);
|
||||
|
||||
/* Arg plus trailing NULL. */
|
||||
ignore_value(VIR_RESIZE_N(cmd->args, cmd->maxargs, cmd->nargs, 1 + 1));
|
||||
VIR_RESIZE_N(cmd->args, cmd->maxargs, cmd->nargs, 1 + 1);
|
||||
|
||||
cmd->args[cmd->nargs++] = arg;
|
||||
}
|
||||
@ -1611,7 +1611,7 @@ virCommandAddArgSet(virCommandPtr cmd, const char *const*vals)
|
||||
narg++;
|
||||
|
||||
/* narg plus trailing NULL. */
|
||||
ignore_value(VIR_RESIZE_N(cmd->args, cmd->maxargs, cmd->nargs, narg + 1));
|
||||
VIR_RESIZE_N(cmd->args, cmd->maxargs, cmd->nargs, narg + 1);
|
||||
|
||||
narg = 0;
|
||||
while (vals[narg] != NULL) {
|
||||
@ -1644,7 +1644,7 @@ virCommandAddArgList(virCommandPtr cmd, ...)
|
||||
va_end(list);
|
||||
|
||||
/* narg plus trailing NULL. */
|
||||
ignore_value(VIR_RESIZE_N(cmd->args, cmd->maxargs, cmd->nargs, narg + 1));
|
||||
VIR_RESIZE_N(cmd->args, cmd->maxargs, cmd->nargs, narg + 1);
|
||||
|
||||
va_start(list, cmd);
|
||||
while (1) {
|
||||
|
@ -3123,8 +3123,7 @@ virFileOpenTty(int *ttyprimary, char **ttyName, int rawmode)
|
||||
name = g_new0(char, len);
|
||||
|
||||
while ((rc = ttyname_r(secondary, name, len)) == ERANGE) {
|
||||
if (VIR_RESIZE_N(name, len, len, len) < 0)
|
||||
goto cleanup;
|
||||
VIR_RESIZE_N(name, len, len, len);
|
||||
}
|
||||
if (rc != 0) {
|
||||
errno = rc;
|
||||
|
@ -262,10 +262,7 @@ void virFirewallFree(virFirewallPtr firewall)
|
||||
|
||||
#define ADD_ARG(rule, str) \
|
||||
do { \
|
||||
ignore_value(VIR_RESIZE_N(rule->args, \
|
||||
rule->argsAlloc, \
|
||||
rule->argsLen, 1)); \
|
||||
\
|
||||
VIR_RESIZE_N(rule->args, rule->argsAlloc, rule->argsLen, 1); \
|
||||
rule->args[rule->argsLen++] = g_strdup(str); \
|
||||
} while (0)
|
||||
|
||||
|
@ -1146,9 +1146,8 @@ virNetlinkEventAddClient(virNetlinkEventHandleCallback handleCB,
|
||||
if (srv->handlesCount == srv->handlesAlloc) {
|
||||
VIR_DEBUG("Used %zu handle slots, adding at least %d more",
|
||||
srv->handlesAlloc, NETLINK_EVENT_ALLOC_EXTENT);
|
||||
if (VIR_RESIZE_N(srv->handles, srv->handlesAlloc,
|
||||
srv->handlesCount, NETLINK_EVENT_ALLOC_EXTENT) < 0)
|
||||
goto error;
|
||||
VIR_RESIZE_N(srv->handles, srv->handlesAlloc,
|
||||
srv->handlesCount, NETLINK_EVENT_ALLOC_EXTENT);
|
||||
}
|
||||
r = srv->handlesCount++;
|
||||
|
||||
@ -1167,7 +1166,7 @@ virNetlinkEventAddClient(virNetlinkEventHandleCallback handleCB,
|
||||
VIR_DEBUG("added client to loop slot: %d. with macaddr ptr=%p", r, macaddr);
|
||||
|
||||
ret = nextWatch++;
|
||||
error:
|
||||
|
||||
virNetlinkEventServerUnlock(srv);
|
||||
return ret;
|
||||
}
|
||||
|
@ -446,8 +446,7 @@ virTypedParamsAddInt(virTypedParameterPtr *params,
|
||||
|
||||
virResetLastError();
|
||||
|
||||
if (VIR_RESIZE_N(*params, max, n, 1) < 0)
|
||||
goto error;
|
||||
VIR_RESIZE_N(*params, max, n, 1);
|
||||
*maxparams = max;
|
||||
|
||||
if (virTypedParameterAssign(*params + n, name,
|
||||
@ -493,8 +492,7 @@ virTypedParamsAddUInt(virTypedParameterPtr *params,
|
||||
|
||||
virResetLastError();
|
||||
|
||||
if (VIR_RESIZE_N(*params, max, n, 1) < 0)
|
||||
goto error;
|
||||
VIR_RESIZE_N(*params, max, n, 1);
|
||||
*maxparams = max;
|
||||
|
||||
if (virTypedParameterAssign(*params + n, name,
|
||||
@ -540,8 +538,7 @@ virTypedParamsAddLLong(virTypedParameterPtr *params,
|
||||
|
||||
virResetLastError();
|
||||
|
||||
if (VIR_RESIZE_N(*params, max, n, 1) < 0)
|
||||
goto error;
|
||||
VIR_RESIZE_N(*params, max, n, 1);
|
||||
*maxparams = max;
|
||||
|
||||
if (virTypedParameterAssign(*params + n, name,
|
||||
@ -587,8 +584,7 @@ virTypedParamsAddULLong(virTypedParameterPtr *params,
|
||||
|
||||
virResetLastError();
|
||||
|
||||
if (VIR_RESIZE_N(*params, max, n, 1) < 0)
|
||||
goto error;
|
||||
VIR_RESIZE_N(*params, max, n, 1);
|
||||
*maxparams = max;
|
||||
|
||||
if (virTypedParameterAssign(*params + n, name,
|
||||
@ -634,8 +630,7 @@ virTypedParamsAddDouble(virTypedParameterPtr *params,
|
||||
|
||||
virResetLastError();
|
||||
|
||||
if (VIR_RESIZE_N(*params, max, n, 1) < 0)
|
||||
goto error;
|
||||
VIR_RESIZE_N(*params, max, n, 1);
|
||||
*maxparams = max;
|
||||
|
||||
if (virTypedParameterAssign(*params + n, name,
|
||||
@ -681,8 +676,7 @@ virTypedParamsAddBoolean(virTypedParameterPtr *params,
|
||||
|
||||
virResetLastError();
|
||||
|
||||
if (VIR_RESIZE_N(*params, max, n, 1) < 0)
|
||||
goto error;
|
||||
VIR_RESIZE_N(*params, max, n, 1);
|
||||
*maxparams = max;
|
||||
|
||||
if (virTypedParameterAssign(*params + n, name,
|
||||
@ -731,8 +725,7 @@ virTypedParamsAddString(virTypedParameterPtr *params,
|
||||
|
||||
virResetLastError();
|
||||
|
||||
if (VIR_RESIZE_N(*params, max, n, 1) < 0)
|
||||
goto error;
|
||||
VIR_RESIZE_N(*params, max, n, 1);
|
||||
*maxparams = max;
|
||||
|
||||
str = g_strdup(value);
|
||||
@ -823,8 +816,7 @@ virTypedParamsAddFromString(virTypedParameterPtr *params,
|
||||
|
||||
virResetLastError();
|
||||
|
||||
if (VIR_RESIZE_N(*params, max, n, 1) < 0)
|
||||
goto error;
|
||||
VIR_RESIZE_N(*params, max, n, 1);
|
||||
*maxparams = max;
|
||||
|
||||
if (virTypedParameterAssignFromStr(*params + n, name, type, value) < 0)
|
||||
|
@ -77,8 +77,7 @@ virTypedParamsValidate(virTypedParameterPtr params, int nparams, ...)
|
||||
name = va_arg(ap, const char *);
|
||||
while (name) {
|
||||
type = va_arg(ap, int);
|
||||
if (VIR_RESIZE_N(keys, nkeysalloc, nkeys, 1) < 0)
|
||||
goto cleanup;
|
||||
VIR_RESIZE_N(keys, nkeysalloc, nkeys, 1);
|
||||
|
||||
if (virStrcpyStatic(keys[nkeys].field, name) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
@ -758,8 +757,7 @@ virTypedParamSetNameVPrintf(virTypedParameterPtr par,
|
||||
static virTypedParameterPtr
|
||||
virTypedParamListExtend(virTypedParamListPtr list)
|
||||
{
|
||||
if (VIR_RESIZE_N(list->par, list->par_alloc, list->npar, 1) < 0)
|
||||
return NULL;
|
||||
VIR_RESIZE_N(list->par, list->par_alloc, list->npar, 1);
|
||||
|
||||
list->npar++;
|
||||
|
||||
|
@ -45,8 +45,7 @@ virURIParamAppend(virURIPtr uri,
|
||||
pname = g_strdup(name);
|
||||
pvalue = g_strdup(value);
|
||||
|
||||
if (VIR_RESIZE_N(uri->params, uri->paramsAlloc, uri->paramsCount, 1) < 0)
|
||||
goto error;
|
||||
VIR_RESIZE_N(uri->params, uri->paramsAlloc, uri->paramsCount, 1);
|
||||
|
||||
uri->params[uri->paramsCount].name = pname;
|
||||
uri->params[uri->paramsCount].value = pvalue;
|
||||
@ -54,11 +53,6 @@ virURIParamAppend(virURIPtr uri,
|
||||
uri->paramsCount++;
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
VIR_FREE(pname);
|
||||
VIR_FREE(pvalue);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -618,8 +618,7 @@ virGetUserEnt(uid_t uid, char **name, gid_t *group, char **dir, char **shell, bo
|
||||
* The given name or uid was not found.
|
||||
*/
|
||||
while ((rc = getpwuid_r(uid, &pwbuf, strbuf, strbuflen, &pw)) == ERANGE) {
|
||||
if (VIR_RESIZE_N(strbuf, strbuflen, strbuflen, strbuflen) < 0)
|
||||
goto cleanup;
|
||||
VIR_RESIZE_N(strbuf, strbuflen, strbuflen, strbuflen);
|
||||
}
|
||||
|
||||
if (rc != 0) {
|
||||
@ -687,10 +686,7 @@ static char *virGetGroupEnt(gid_t gid)
|
||||
* The given name or gid was not found.
|
||||
*/
|
||||
while ((rc = getgrgid_r(gid, &grbuf, strbuf, strbuflen, &gr)) == ERANGE) {
|
||||
if (VIR_RESIZE_N(strbuf, strbuflen, strbuflen, strbuflen) < 0) {
|
||||
VIR_FREE(strbuf);
|
||||
return NULL;
|
||||
}
|
||||
VIR_RESIZE_N(strbuf, strbuflen, strbuflen, strbuflen);
|
||||
}
|
||||
if (rc != 0 || gr == NULL) {
|
||||
if (rc != 0) {
|
||||
@ -765,8 +761,7 @@ virGetUserIDByName(const char *name, uid_t *uid, bool missing_ok)
|
||||
strbuf = g_new0(char, strbuflen);
|
||||
|
||||
while ((rc = getpwnam_r(name, &pwbuf, strbuf, strbuflen, &pw)) == ERANGE) {
|
||||
if (VIR_RESIZE_N(strbuf, strbuflen, strbuflen, strbuflen) < 0)
|
||||
goto cleanup;
|
||||
VIR_RESIZE_N(strbuf, strbuflen, strbuflen, strbuflen);
|
||||
}
|
||||
|
||||
if (!pw) {
|
||||
@ -846,8 +841,7 @@ virGetGroupIDByName(const char *name, gid_t *gid, bool missing_ok)
|
||||
strbuf = g_new0(char, strbuflen);
|
||||
|
||||
while ((rc = getgrnam_r(name, &grbuf, strbuf, strbuflen, &gr)) == ERANGE) {
|
||||
if (VIR_RESIZE_N(strbuf, strbuflen, strbuflen, strbuflen) < 0)
|
||||
goto cleanup;
|
||||
VIR_RESIZE_N(strbuf, strbuflen, strbuflen, strbuflen);
|
||||
}
|
||||
|
||||
if (!gr) {
|
||||
|
@ -214,8 +214,7 @@ testResizeArray(const void *opaque G_GNUC_UNUSED)
|
||||
t[i].b = 20;
|
||||
}
|
||||
|
||||
if (VIR_RESIZE_N(t, at, nt, 8) < 0)
|
||||
goto cleanup;
|
||||
VIR_RESIZE_N(t, at, nt, 8);
|
||||
|
||||
if (testCheckNonNull(t) < 0)
|
||||
goto cleanup;
|
||||
|
Loading…
Reference in New Issue
Block a user