Skip to content

Commit 54b1335

Browse files
committed
Merge branch 'rs/fmt-merge-msg-leakfix'
Leakfix. * rs/fmt-merge-msg-leakfix: transport-helper: plug strbuf and string_list leaks
2 parents eacf669 + 176cb97 commit 54b1335

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

transport-helper.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,8 @@ static int push_refs_with_push(struct transport *transport,
882882
struct strbuf cas = STRBUF_INIT;
883883
strbuf_addf(&cas, "%s:%s",
884884
ref->name, oid_to_hex(&ref->old_oid_expect));
885-
string_list_append(&cas_options, strbuf_detach(&cas, NULL));
885+
string_list_append_nodup(&cas_options,
886+
strbuf_detach(&cas, NULL));
886887
}
887888
}
888889
if (buf.len == 0) {
@@ -897,6 +898,7 @@ static int push_refs_with_push(struct transport *transport,
897898
strbuf_addch(&buf, '\n');
898899
sendline(data, &buf);
899900
strbuf_release(&buf);
901+
string_list_clear(&cas_options, 0);
900902

901903
return push_update_refs_status(data, remote_refs, flags);
902904
}
@@ -930,7 +932,8 @@ static int push_refs_with_export(struct transport *transport,
930932
private = apply_refspecs(data->refspecs, data->refspec_nr, ref->name);
931933
if (private && !get_oid(private, &oid)) {
932934
strbuf_addf(&buf, "^%s", private);
933-
string_list_append(&revlist_args, strbuf_detach(&buf, NULL));
935+
string_list_append_nodup(&revlist_args,
936+
strbuf_detach(&buf, NULL));
934937
oidcpy(&ref->old_oid, &oid);
935938
}
936939
free(private);

0 commit comments

Comments
 (0)