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>
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;
if ( ( script = calloc (1, sizeof *script) ) == NULL )
{
- if (needer != NULL) free (needer);
+ free (needer);
return SIG_FAILED;
}
service = calloc (1, strlen (name) + sizeof *service);
unavailable_services->prev = service;
unavailable_services = service;
free (script);
- if (needer != NULL) free (needer);
+ free (needer);
return SIG_FAILED;
/*break;*/
default: /* Parent */
if (mfp) {
if (mfp->mntent_fp)
fclose(mfp->mntent_fp);
- if (mfp->mntent_file)
- free(mfp->mntent_file);
+ free(mfp->mntent_file);
free(mfp);
}
}
newbuf = xmalloc(m + n + 1);
memcpy(newbuf, link_path, n);
memcpy(newbuf + n, path, m + 1);
- if (buf)
- free(buf);
+ free(buf);
path = buf = newbuf;
#endif
}
/* Make sure it's null terminated. */
*npath = '\0';
- if (buf)
- free(buf);
+ free(buf);
return resolved_path;
err:
- if (buf)
- free(buf);
+ free(buf);
return NULL;
}
static void
crc32cleanup_le(void)
{
- if (crc32table_le) free(crc32table_le);
+ free(crc32table_le);
crc32table_le = NULL;
}
static void
crc32cleanup_be(void)
{
- if (crc32table_be) free(crc32table_be);
+ free(crc32table_be);
crc32table_be = NULL;
}
int last_used_index=-1;
if (!find_valid_gpt (fd, &gpt, &ptes) || !gpt || !ptes) {
- if (gpt)
- free (gpt);
- if (ptes)
- free (ptes);
+ free (gpt);
+ free (ptes);
return 0;
}