lib/: Use REALLOCF() instead of its pattern

Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
Alejandro Colomar
2024-07-01 21:40:11 -05:00
committed by Serge Hallyn
parent 23663a1607
commit d611d1a947
2 changed files with 9 additions and 13 deletions
+3 -4
View File
@@ -648,11 +648,10 @@ int commonio_open (struct commonio_db *db, int mode)
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),
+6 -9
View File
@@ -929,9 +929,8 @@ static bool all_digits(const char *str)
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);
@@ -957,13 +956,11 @@ static int append_uids(uid_t **uids, const char *owner, int n)
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;
}