Jacob Keller <jacob.e.keller@xxxxxxxxx> writes: > diff --git a/builtin/send-pack.c b/builtin/send-pack.c > index c6e0e9d05186..61486e378cab 100644 > --- a/builtin/send-pack.c > +++ b/builtin/send-pack.c > @@ -343,6 +343,7 @@ int cmd_send_pack(int argc, > free_refs(remote_refs); > free_refs(local_refs); > refspec_clear(&rs); > + oid_array_clear(&extra_have); > oid_array_clear(&shallow); > clear_cas_option(&cas); > return ret; There is an early exit from the function that would bypass these clean-up. Perhaps something like this on top? builtin/send-pack.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git c/builtin/send-pack.c w/builtin/send-pack.c index b28da7ddd7..6ce9f6665a 100644 --- c/builtin/send-pack.c +++ w/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);