Skip to content

Commit d4a59c5

Browse files
committed
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
2 parents 0629460 + b0e9d25 commit d4a59c5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

builtin/send-pack.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,10 @@ int cmd_send_pack(int argc,
304304
flags |= MATCH_REFS_MIRROR;
305305

306306
/* match them up */
307-
if (match_push_refs(local_refs, &remote_refs, &rs, flags))
308-
return -1;
309-
307+
if (match_push_refs(local_refs, &remote_refs, &rs, flags)) {
308+
ret = -1;
309+
goto cleanup;
310+
}
310311
if (!is_empty_cas(&cas))
311312
apply_push_cas(&cas, remote, remote_refs);
312313

@@ -339,10 +340,12 @@ int cmd_send_pack(int argc,
339340
/* stable plumbing output; do not modify or localize */
340341
fprintf(stderr, "Everything up-to-date\n");
341342

343+
cleanup:
342344
string_list_clear(&push_options, 0);
343345
free_refs(remote_refs);
344346
free_refs(local_refs);
345347
refspec_clear(&rs);
348+
oid_array_clear(&extra_have);
346349
oid_array_clear(&shallow);
347350
clear_cas_option(&cas);
348351
return ret;

0 commit comments

Comments
 (0)