Signed-off-by: Alejandro Colomar <alx@kernel.org>
size_t len;
buflen += BUFLEN;
- cp = REALLOC(buf, buflen, char);
- if (NULL == cp) {
- goto cleanup_buf;
+ buf = REALLOCF(buf, buflen, char);
+ if (NULL == buf) {
+ goto cleanup_ENOMEM;
}
- buf = cp;
len = strlen (buf);
if (db->ops->fgets (buf + len,
(int) (buflen - len),
static int append_uids(uid_t **uids, const char *owner, int n)
{
- uid_t owner_uid;
- uid_t *ret;
- int i;
+ int i;
+ uid_t owner_uid;
if (all_digits(owner)) {
i = sscanf(owner, "%d", &owner_uid);
return n;
}
- ret = REALLOC(*uids, n + 1, uid_t);
- if (!ret) {
- free(*uids);
+ *uids = REALLOCF(*uids, n + 1, uid_t);
+ if (!*uids)
return -1;
- }
- ret[n] = owner_uid;
- *uids = ret;
+
+ (*uids)[n] = owner_uid;
return n+1;
}