diff options
author | Jim Meyering | 2008-03-12 11:42:16 +0100 |
---|---|---|
committer | Karel Zak | 2008-03-12 12:00:39 +0100 |
commit | 71c445db69d865329c38ab95328780205ada751b (patch) | |
tree | 1b6659b156864d2dc2b5848dff84213d5af34bf6 /login-utils | |
parent | ldattach: new command (diff) | |
download | kernel-qcow2-util-linux-71c445db69d865329c38ab95328780205ada751b.tar.gz kernel-qcow2-util-linux-71c445db69d865329c38ab95328780205ada751b.tar.xz kernel-qcow2-util-linux-71c445db69d865329c38ab95328780205ada751b.zip |
remove useless if-before-free tests.
E.g., in this example, the "if (p)" test is useless.
if (p)
free (p);
I've been removing such tests systematically.
Here's where I proposed it to the git folks, along with justification
for why it's ok to perform this transformation, these days (no one
uses SunOS4 anymore):
http://thread.gmane.org/gmane.comp.version-control.git/74187
Signed-off-by: Jim Meyering <meyering@redhat.com>
Diffstat (limited to 'login-utils')
-rw-r--r-- | login-utils/setpwnam.c | 2 | ||||
-rw-r--r-- | login-utils/simpleinit.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/login-utils/setpwnam.c b/login-utils/setpwnam.c index 5a46863a8..2aa7dd5bb 100644 --- a/login-utils/setpwnam.c +++ b/login-utils/setpwnam.c @@ -185,7 +185,7 @@ fail: if (fp != NULL) fclose (fp); if (pwf != NULL) fclose(pwf); if (fd >= 0) close (fd); - if (linebuf != NULL) free(linebuf); + free(linebuf); unlink(PTMP_FILE); errno = save_errno; return -1; diff --git a/login-utils/simpleinit.c b/login-utils/simpleinit.c index 89c14a8dc..739306cf4 100644 --- a/login-utils/simpleinit.c +++ b/login-utils/simpleinit.c @@ -1048,7 +1048,7 @@ static int run_command (const char *file, const char *name, pid_t pid) if ( ( script = calloc (1, sizeof *script) ) == NULL ) { - if (needer != NULL) free (needer); + free (needer); return SIG_FAILED; } service = calloc (1, strlen (name) + sizeof *service); @@ -1073,7 +1073,7 @@ static int run_command (const char *file, const char *name, pid_t pid) unavailable_services->prev = service; unavailable_services = service; free (script); - if (needer != NULL) free (needer); + free (needer); return SIG_FAILED; /*break;*/ default: /* Parent */ |