Skip to content

Commit b0e9d25

Browse files
committed
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 <[email protected]>
1 parent d1c4486 commit b0e9d25

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

builtin/send-pack.c

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

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

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

344+
cleanup:
343345
string_list_clear(&push_options, 0);
344346
free_refs(remote_refs);
345347
free_refs(local_refs);

0 commit comments

Comments
 (0)