From: Alejandro Colomar Date: Sun, 12 May 2024 21:15:12 +0000 (+0200) Subject: lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM X-Git-Tag: 4.17.0-rc1~194 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=077f7b6adebc93ef57af4cdb3e21840aaea04fc6;p=thirdparty%2Fshadow.git lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM We don't need to set ENOMEM on failure of those functions. Signed-off-by: Alejandro Colomar --- diff --git a/lib/commonio.c b/lib/commonio.c index 1a6f1db5b..1d0ba8909 100644 --- a/lib/commonio.c +++ b/lib/commonio.c @@ -635,9 +635,8 @@ int commonio_open (struct commonio_db *db, int mode) buflen = BUFLEN; buf = MALLOC(buflen, char); - if (NULL == buf) { - goto cleanup_ENOMEM; - } + if (NULL == buf) + goto cleanup_errno; while (db->ops->fgets (buf, buflen, db->fp) == buf) { char *cp; @@ -649,9 +648,9 @@ int commonio_open (struct commonio_db *db, int mode) buflen += BUFLEN; buf = REALLOCF(buf, buflen, char); - if (NULL == buf) { - goto cleanup_ENOMEM; - } + if (NULL == buf) + goto cleanup_errno; + len = strlen (buf); if (db->ops->fgets (buf + len, (int) (buflen - len), @@ -714,7 +713,6 @@ int commonio_open (struct commonio_db *db, int mode) free (line); cleanup_buf: free (buf); - cleanup_ENOMEM: errno = ENOMEM; cleanup_errno: saved_errno = errno;