Skip to content

Commit 9d01cfe

Browse files
avargitster
authored andcommitted
commit-graph: fix a parse_options_concat() leak
When the parse_options_concat() was added to this file in 84e4484 (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2139bd0 commit 9d01cfe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

builtin/commit-graph.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,8 @@ static int graph_write(int argc, const char **argv, const char *prefix)
269269

270270
if (opts.reachable) {
271271
if (write_commit_graph_reachable(odb, flags, &write_opts))
272-
return 1;
273-
return 0;
272+
result = 1;
273+
goto cleanup;
274274
}
275275

276276
if (opts.stdin_packs) {

0 commit comments

Comments
 (0)