diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-12-27 11:16:26 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-12-27 11:16:26 -0800 |
commit | 54b1335ae3ced34310fbc2abc92431a2a7f1f7fa (patch) | |
tree | 49b8133bddfa6b9e045ea06db04230b31cc3154b /transport-helper.c | |
parent | eacf669cec77a60a220b23acfb6e211d0a0409c8 (diff) | |
parent | 176cb979fe7c1cf6b789c9263ca20312385c1f31 (diff) | |
download | git-54b1335ae3ced34310fbc2abc92431a2a7f1f7fa.tar.gz |
Merge branch 'rs/fmt-merge-msg-leakfix'
Leakfix.
* rs/fmt-merge-msg-leakfix:
transport-helper: plug strbuf and string_list leaks
Diffstat (limited to 'transport-helper.c')
-rw-r--r-- | transport-helper.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/transport-helper.c b/transport-helper.c index bf05a2dcf1..413cd7b551 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -882,7 +882,8 @@ static int push_refs_with_push(struct transport *transport, struct strbuf cas = STRBUF_INIT; strbuf_addf(&cas, "%s:%s", ref->name, oid_to_hex(&ref->old_oid_expect)); - string_list_append(&cas_options, strbuf_detach(&cas, NULL)); + string_list_append_nodup(&cas_options, + strbuf_detach(&cas, NULL)); } } if (buf.len == 0) { @@ -897,6 +898,7 @@ static int push_refs_with_push(struct transport *transport, strbuf_addch(&buf, '\n'); sendline(data, &buf); strbuf_release(&buf); + string_list_clear(&cas_options, 0); return push_update_refs_status(data, remote_refs, flags); } @@ -930,7 +932,8 @@ static int push_refs_with_export(struct transport *transport, private = apply_refspecs(data->refspecs, data->refspec_nr, ref->name); if (private && !get_oid(private, &oid)) { strbuf_addf(&buf, "^%s", private); - string_list_append(&revlist_args, strbuf_detach(&buf, NULL)); + string_list_append_nodup(&revlist_args, + strbuf_detach(&buf, NULL)); oidcpy(&ref->old_oid, &oid); } free(private); |