diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-05-20 20:39:38 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-05-20 20:39:38 +0000 |
commit | 88917b0f143e2eac468aea14338b4d9eddba389d (patch) | |
tree | 790fd49f0632b93a7ad9cd02974bff82efa60b25 /libc/inet/rpc | |
parent | 43eb269ab1d216074e18dadc74c9671398dfe938 (diff) |
replace "if (p) free(p)" by just "free(p)" - free(NULL) is safe.
Diffstat (limited to 'libc/inet/rpc')
-rw-r--r-- | libc/inet/rpc/auth_unix.c | 3 | ||||
-rw-r--r-- | libc/inet/rpc/getrpcent.c | 9 | ||||
-rw-r--r-- | libc/inet/rpc/rcmd.c | 11 |
3 files changed, 7 insertions, 16 deletions
diff --git a/libc/inet/rpc/auth_unix.c b/libc/inet/rpc/auth_unix.c index 8015e4f61..0654b51c1 100644 --- a/libc/inet/rpc/auth_unix.c +++ b/libc/inet/rpc/auth_unix.c @@ -212,8 +212,7 @@ authunix_create_default (void) list of groups to NGRPS members since the code in authuxprot.c transforms a fixed array. Grrr. */ ret_auth = authunix_create (machname, uid, gid, MIN (NGRPS, len), gids); - if (gids) - free (gids); + free (gids); return ret_auth; } libc_hidden_def(authunix_create_default) diff --git a/libc/inet/rpc/getrpcent.c b/libc/inet/rpc/getrpcent.c index 7b9b93758..186bd130f 100644 --- a/libc/inet/rpc/getrpcent.c +++ b/libc/inet/rpc/getrpcent.c @@ -93,10 +93,8 @@ void endrpcent(void) return; if (d->stayopen) return; - if (d->current) { - free(d->current); - d->current = NULL; - } + free(d->current); + d->current = NULL; if (d->rpcf) { fclose(d->rpcf); d->rpcf = NULL; @@ -115,8 +113,7 @@ void setrpcent(int f) d->rpcf = fopen(RPCDB, "r"); else rewind(d->rpcf); - if (d->current) - free(d->current); + free(d->current); d->current = NULL; d->stayopen |= f; } diff --git a/libc/inet/rpc/rcmd.c b/libc/inet/rpc/rcmd.c index 47b92751b..6a9b437bf 100644 --- a/libc/inet/rpc/rcmd.c +++ b/libc/inet/rpc/rcmd.c @@ -197,9 +197,7 @@ int rcmd(ahost, rport, locuser, remuser, cmd, fd2p) #ifdef __ARCH_USE_MMU__ tmphstbuf = alloca (hstbuflen); #else - if (tmphstbuf) { - free(tmphstbuf); - } + free(tmphstbuf); tmphstbuf = malloc (hstbuflen); #endif } @@ -411,9 +409,7 @@ int ruserok(rhost, superuser, ruser, luser) #ifdef __ARCH_USE_MMU__ buffer = alloca (buflen); #else - if (buffer) { - free(buffer); - } + free(buffer); buffer = malloc (buflen); #endif } @@ -780,8 +776,7 @@ __ivaliduser2(hostf, raddr, luser, ruser, rhost) } } - if (buf != NULL) - free (buf); + free (buf); return retval; } |