diff options
| author | Junio C Hamano <gitster@pobox.com> | 2025-07-01 14:17:25 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-07-01 14:17:25 -0700 |
| commit | b0e9d258654bb2c50f095ba05599d8badadb71a2 (patch) | |
| tree | 532a5533b2b00747bc60f49bee090c7fa8ec1b59 /builtin/send-pack.c | |
| parent | send-pack: clean up extra_have oid array (diff) | |
| download | git-b0e9d258654bb2c50f095ba05599d8badadb71a2.tar.gz git-b0e9d258654bb2c50f095ba05599d8badadb71a2.zip | |
send-pack: clean-up even when taking an early exit
Previous commit has plugged one leak in the normal code path, but
there is an early exit that leaves without releasing any resources
acquired in the function.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/send-pack.c')
| -rw-r--r-- | builtin/send-pack.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/builtin/send-pack.c b/builtin/send-pack.c index b28da7ddd7..6ce9f6665a 100644 --- a/builtin/send-pack.c +++ b/builtin/send-pack.c @@ -305,9 +305,10 @@ int cmd_send_pack(int argc, flags |= MATCH_REFS_MIRROR; /* match them up */ - if (match_push_refs(local_refs, &remote_refs, &rs, flags)) - return -1; - + if (match_push_refs(local_refs, &remote_refs, &rs, flags)) { + ret = -1; + goto cleanup; + } if (!is_empty_cas(&cas)) apply_push_cas(&cas, remote, remote_refs); @@ -340,6 +341,7 @@ int cmd_send_pack(int argc, /* stable plumbing output; do not modify or localize */ fprintf(stderr, "Everything up-to-date\n"); +cleanup: string_list_clear(&push_options, 0); free_refs(remote_refs); free_refs(local_refs); |
