From: Junio C Hamano Date: Wed, 15 Aug 2018 22:08:28 +0000 (-0700) Subject: Merge branch 'rs/remote-mv-leakfix' X-Git-Tag: v2.19.0-rc0~60 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/11ea82ae379e8a8b684a0a2866771ec116d119ab?hp=-c Merge branch 'rs/remote-mv-leakfix' Leakfix. * rs/remote-mv-leakfix: remote: clear string_list after use in mv() --- 11ea82ae379e8a8b684a0a2866771ec116d119ab diff --combined builtin/remote.c index c74ee88690,213c07b043..07bd51f8eb --- a/builtin/remote.c +++ b/builtin/remote.c @@@ -8,7 -8,6 +8,7 @@@ #include "run-command.h" #include "refs.h" #include "refspec.h" +#include "object-store.h" #include "argv-array.h" static const char * const builtin_remote_usage[] = { @@@ -566,7 -565,7 +566,7 @@@ static int read_remote_branches(const c 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 -611,7 +612,7 @@@ static int mv(int argc, const char **ar 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 -733,7 +734,7 @@@ if (create_symref(buf.buf, buf2.buf, buf3.buf)) die(_("creating '%s' failed"), buf.buf); } + string_list_clear(&remote_branches, 1); return 0; }