From 71c445db69d865329c38ab95328780205ada751b Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 12 Mar 2008 11:42:16 +0100 Subject: 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 --- partx/crc32.c | 4 ++-- partx/gpt.c | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'partx') diff --git a/partx/crc32.c b/partx/crc32.c index 42d803d14..4120f7289 100644 --- a/partx/crc32.c +++ b/partx/crc32.c @@ -96,7 +96,7 @@ crc32init_le(void) static void crc32cleanup_le(void) { - if (crc32table_le) free(crc32table_le); + free(crc32table_le); crc32table_le = NULL; } @@ -198,7 +198,7 @@ crc32init_be(void) static void crc32cleanup_be(void) { - if (crc32table_be) free(crc32table_be); + free(crc32table_be); crc32table_be = NULL; } diff --git a/partx/gpt.c b/partx/gpt.c index adcaccdd8..b146c9e7e 100644 --- a/partx/gpt.c +++ b/partx/gpt.c @@ -585,10 +585,8 @@ read_gpt_pt (int fd, struct slice all, struct slice *sp, int ns) 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; } -- cgit v1.2.3-55-g7522