summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-02-13 11:14:24 -0800
committerJunio C Hamano <gitster@pobox.com>2017-02-18 12:50:29 -0800
commit70fc91272ca30a985567bdc85d74dd3afafda1f1 (patch)
tree58658c36b255336f9a4f46ca1b7130c4bd435064
parent9889c96293f80f58a6f96d1d39709fbb37bb9787 (diff)
downloadgit-pb/bisect.tar.gz
fixup! bisect--helper: `bisect_next_check` & bisect_voc shell function in Cpb/bisect
René Scharfe <l.s.r@web.de> writes: > Initializing to NULL is still the correct thing to do, of course -- > together with removing the conditionals (or at least the negations). So, let's give Pranit a concrete "here is what we want to see squashed in", while you guys discuss peculiarity with various platforms and their system headers, which admittedly is a more interesting tangent ;-) There are early returns with "goto finish" even before _syn variables are first assigned to, so they would need to be initialized to NULL. The other two get their initial values right at the beginning, so they are OK. builtin/bisect--helper.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/bisect--helper.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c
index 8cd6527bd1..6949e8e5ca 100644
--- a/builtin/bisect--helper.c
+++ b/builtin/bisect--helper.c
@@ -280,7 +280,7 @@ static int bisect_next_check(const struct bisect_terms *terms,
int missing_good = 1, missing_bad = 1, retval = 0;
char *bad_ref = xstrfmt("refs/bisect/%s", terms->term_bad);
char *good_glob = xstrfmt("%s-*", terms->term_good);
- char *bad_syn, *good_syn;
+ char *bad_syn = NULL, *good_syn = NULL;
if (ref_exists(bad_ref))
missing_bad = 0;
@@ -341,14 +341,10 @@ static int bisect_next_check(const struct bisect_terms *terms,
}
goto finish;
finish:
- if (!bad_ref)
- free(bad_ref);
- if (!good_glob)
- free(good_glob);
- if (!bad_syn)
- free(bad_syn);
- if (!good_syn)
- free(good_syn);
+ free(bad_ref);
+ free(good_glob);
+ free(bad_syn);
+ free(good_syn);
return retval;
}