diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-08-16 00:08:28 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-08-16 00:08:28 +0200 |
commit | 11ea82ae379e8a8b684a0a2866771ec116d119ab (patch) | |
tree | fc967f15bf116007f268330813518c5155ffe017 /builtin/remote.c | |
parent | Merge branch 'es/mw-to-git-chain-fix' (diff) | |
parent | remote: clear string_list after use in mv() (diff) | |
download | git-11ea82ae379e8a8b684a0a2866771ec116d119ab.tar.xz git-11ea82ae379e8a8b684a0a2866771ec116d119ab.zip |
Merge branch 'rs/remote-mv-leakfix'
Leakfix.
* rs/remote-mv-leakfix:
remote: clear string_list after use in mv()
Diffstat (limited to 'builtin/remote.c')
-rw-r--r-- | builtin/remote.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/builtin/remote.c b/builtin/remote.c index c74ee88690..07bd51f8eb 100644 --- a/builtin/remote.c +++ b/builtin/remote.c @@ -566,7 +566,7 @@ static int read_remote_branches(const char *refname, strbuf_addf(&buf, "refs/remotes/%s/", rename->old_name); if (starts_with(refname, buf.buf)) { - item = string_list_append(rename->remote_branches, xstrdup(refname)); + item = string_list_append(rename->remote_branches, refname); symref = resolve_ref_unsafe(refname, RESOLVE_REF_READING, NULL, &flag); if (symref && (flag & REF_ISSYMREF)) @@ -612,7 +612,7 @@ static int mv(int argc, const char **argv) struct remote *oldremote, *newremote; struct strbuf buf = STRBUF_INIT, buf2 = STRBUF_INIT, buf3 = STRBUF_INIT, old_remote_context = STRBUF_INIT; - struct string_list remote_branches = STRING_LIST_INIT_NODUP; + struct string_list remote_branches = STRING_LIST_INIT_DUP; struct rename_info rename; int i, refspec_updated = 0; @@ -734,6 +734,7 @@ static int mv(int argc, const char **argv) if (create_symref(buf.buf, buf2.buf, buf3.buf)) die(_("creating '%s' failed"), buf.buf); } + string_list_clear(&remote_branches, 1); return 0; } |