From: Ævar Arnfjörð Bjarmason Date: Mon, 6 Feb 2023 23:07:46 +0000 (+0100) Subject: commit-graph: fix a parse_options_concat() leak X-Git-Tag: v2.40.0-rc0~7^2~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9d01cfed6915b1e99c266fd578e39c7aba7767dc;p=thirdparty%2Fgit.git commit-graph: fix a parse_options_concat() leak When the parse_options_concat() was added to this file in 84e4484f128 (commit-graph: use parse_options_concat(), 2021-08-23) we wouldn't free() it if we returned early in these cases. Since "result" is 0 by default we can "goto cleanup" in both cases, and only need to set "result" if write_commit_graph_reachable() fails. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c index 0102ac8540..93704f95a9 100644 --- a/builtin/commit-graph.c +++ b/builtin/commit-graph.c @@ -269,8 +269,8 @@ static int graph_write(int argc, const char **argv, const char *prefix) if (opts.reachable) { if (write_commit_graph_reachable(odb, flags, &write_opts)) - return 1; - return 0; + result = 1; + goto cleanup; } if (opts.stdin_packs) {