Merge branch 'jk/fix-leak-send-pack'

Leakfix.

* jk/fix-leak-send-pack:
  send-pack: clean-up even when taking an early exit
  send-pack: clean up extra_have oid array
This commit is contained in:
Junio C Hamano
2025-07-07 14:12:56 -07:00

View File

@@ -304,9 +304,10 @@ int cmd_send_pack(int argc,
flags |= MATCH_REFS_MIRROR; flags |= MATCH_REFS_MIRROR;
/* match them up */ /* match them up */
if (match_push_refs(local_refs, &remote_refs, &rs, flags)) if (match_push_refs(local_refs, &remote_refs, &rs, flags)) {
return -1; ret = -1;
goto cleanup;
}
if (!is_empty_cas(&cas)) if (!is_empty_cas(&cas))
apply_push_cas(&cas, remote, remote_refs); apply_push_cas(&cas, remote, remote_refs);
@@ -339,10 +340,12 @@ int cmd_send_pack(int argc,
/* stable plumbing output; do not modify or localize */ /* stable plumbing output; do not modify or localize */
fprintf(stderr, "Everything up-to-date\n"); fprintf(stderr, "Everything up-to-date\n");
cleanup:
string_list_clear(&push_options, 0); string_list_clear(&push_options, 0);
free_refs(remote_refs); free_refs(remote_refs);
free_refs(local_refs); free_refs(local_refs);
refspec_clear(&rs); refspec_clear(&rs);
oid_array_clear(&extra_have);
oid_array_clear(&shallow); oid_array_clear(&shallow);
clear_cas_option(&cas); clear_cas_option(&cas);
return ret; return ret;