aboutsummaryrefslogtreecommitdiff
path: root/builtin-apply.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-08-27 21:19:39 -0700
committerJunio C Hamano <junkio@cox.net>2006-08-27 21:19:39 -0700
commit4cac42b1324951579036a9d3ac403f5c2c3eeed8 (patch)
tree5106e1aff2bd1d90fef4c26550b777dbe1142429 /builtin-apply.c
parentb3c952f8386cebe12fc95227866683bb1cec99a9 (diff)
downloadgit-4cac42b1324951579036a9d3ac403f5c2c3eeed8.tar.gz
git-4cac42b1324951579036a9d3ac403f5c2c3eeed8.tar.xz
free(NULL) is perfectly valid.
Jonas noticed some places say "if (X) free(X)" which is totally unnecessary. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-apply.c')
-rw-r--r--builtin-apply.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/builtin-apply.c b/builtin-apply.c
index b47ccacc2..1a1deaf78 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -1131,8 +1131,7 @@ static struct fragment *parse_binary_hunk(char **buf_p,
return frag;
corrupt:
- if (data)
- free(data);
+ free(data);
*status_p = -1;
error("corrupt binary patch at line %d: %.*s",
linenr-1, llen-1, buffer);
@@ -1329,8 +1328,7 @@ static void show_stats(struct patch *patch)
printf(" %s%-*s |%5d %.*s%.*s\n", prefix,
len, name, patch->lines_added + patch->lines_deleted,
add, pluses, del, minuses);
- if (qname)
- free(qname);
+ free(qname);
}
static int read_old_data(struct stat *st, const char *path, void *buf, unsigned long size)