summaryrefslogtreecommitdiff
path: root/parse-options-cb.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2016-10-08 14:14:57 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-10-10 18:37:41 (GMT)
commit39ea59a2570547166834ceeff9ae0c0c05748f35 (patch)
treeb9874de8e3ca7b71f3ca23dd8f0a92fe210b2ec0 /parse-options-cb.c
parent353d84c537485500989b190c5af93ad224264e2c (diff)
downloadgit-39ea59a2570547166834ceeff9ae0c0c05748f35.zip
git-39ea59a2570547166834ceeff9ae0c0c05748f35.tar.gz
git-39ea59a2570547166834ceeff9ae0c0c05748f35.tar.bz2
remove unnecessary NULL check before free(3)
free(3) handles NULL pointers just fine. Add a semantic patch for removing unnecessary NULL checks before calling this function, and apply it on the code base. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'parse-options-cb.c')
-rw-r--r--parse-options-cb.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/parse-options-cb.c b/parse-options-cb.c
index 9667bc7..1681883 100644
--- a/parse-options-cb.c
+++ b/parse-options-cb.c
@@ -199,8 +199,7 @@ int parse_opt_passthru(const struct option *opt, const char *arg, int unset)
if (recreate_opt(&sb, opt, arg, unset) < 0)
return -1;
- if (*opt_value)
- free(*opt_value);
+ free(*opt_value);
*opt_value = strbuf_detach(&sb, NULL);