Don't test for NULL before calling free(3)
free(3) accepts NULL, since the oldest ISO C. I guess the paranoid code was taking care of prehistoric implementations of free(3). I've never known of an implementation that doesn't conform to this, so let's simplify this. Remove xfree(3), which was effectively an equivalent of free(3). Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
committed by
Iker Pedrosa
parent
1b0e189e35
commit
0d9799de04
@ -54,8 +54,7 @@ static char **list (char *s)
|
||||
rbuf = malloc (size * sizeof (char *));
|
||||
}
|
||||
if (!rbuf) {
|
||||
if (members)
|
||||
free (members);
|
||||
free (members);
|
||||
members = 0;
|
||||
size = 0;
|
||||
return (char **) 0;
|
||||
@ -89,8 +88,7 @@ struct group *sgetgrent (const char *buf)
|
||||
if (strlen (buf) + 1 > size) {
|
||||
/* no need to use realloc() here - just free it and
|
||||
allocate a larger block */
|
||||
if (grpbuf)
|
||||
free (grpbuf);
|
||||
free (grpbuf);
|
||||
size = strlen (buf) + 1000; /* at least: strlen(buf) + 1 */
|
||||
grpbuf = malloc (size);
|
||||
if (!grpbuf) {
|
||||
|
Reference in New Issue
Block a user