diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-12-14 15:55:46 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-12-14 15:55:46 +0900 |
commit | 9ea1378d046d764642718f1b070689072bde4601 (patch) | |
tree | b15bce1d35006e79f91cc2a985e7b69a77e0fd3d /connected.c | |
parent | 7576e512cec7630ba2a35af33fa00868cedb8e18 (diff) | |
parent | ac95f5d36adb42980064587fd7910fa275ff853e (diff) | |
download | git-9ea1378d046d764642718f1b070689072bde4601.tar.gz |
Merge branch 'ab/various-leak-fixes'
Various leak fixes.
* ab/various-leak-fixes:
built-ins: use free() not UNLEAK() if trivial, rm dead code
revert: fix parse_options_concat() leak
cherry-pick: free "struct replay_opts" members
rebase: don't leak on "--abort"
connected.c: free the "struct packed_git"
sequencer.c: fix "opts->strategy" leak in read_strategy_opts()
ls-files: fix a --with-tree memory leak
revision API: call graph_clear() in release_revisions()
unpack-file: fix ancient leak in create_temp_file()
built-ins & libs & helpers: add/move destructors, fix leaks
dir.c: free "ident" and "exclude_per_dir" in "struct untracked_cache"
read-cache.c: clear and free "sparse_checkout_patterns"
commit: discard partial cache before (re-)reading it
{reset,merge}: call discard_index() before returning
tests: mark tests as passing with SANITIZE=leak
Diffstat (limited to 'connected.c')
-rw-r--r-- | connected.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/connected.c b/connected.c index 4f6388eed7..b90fd61790 100644 --- a/connected.c +++ b/connected.c @@ -85,6 +85,7 @@ int check_connected(oid_iterate_fn fn, void *cb_data, promisor_pack_found: ; } while ((oid = fn(cb_data)) != NULL); + free(new_pack); return 0; } @@ -121,8 +122,10 @@ no_promisor_pack_found: else rev_list.no_stderr = opt->quiet; - if (start_command(&rev_list)) + if (start_command(&rev_list)) { + free(new_pack); return error(_("Could not run 'git rev-list'")); + } sigchain_push(SIGPIPE, SIG_IGN); @@ -154,5 +157,6 @@ no_promisor_pack_found: err = error_errno(_("failed to close rev-list's stdin")); sigchain_pop(SIGPIPE); + free(new_pack); return finish_command(&rev_list) || err; } |