aboutsummaryrefslogtreecommitdiff
path: root/builtin-remote.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-11-17 07:54:07 -0800
committerJunio C Hamano <gitster@pobox.com>2008-11-17 07:54:07 -0800
commit83b767360a183abf29cb0cc0fd647fb683cff616 (patch)
tree6efa1793ee0cf810b44a6c3d826070d61f60cda0 /builtin-remote.c
parent357af14fc491748c874cd8791a5bcf5e1a426ee8 (diff)
downloadgit-83b767360a183abf29cb0cc0fd647fb683cff616.tar.gz
git-83b767360a183abf29cb0cc0fd647fb683cff616.tar.xz
builtin-remote.c: plug a small memory leak in get_one_remote_for_updates()
We know that the string pointed at by remote->name won't change. It can be borrowed as the key in the string_list without copying. Other parts of existing code such as get_one_entry() already rely on this fact. Noticed by Cheng Renquan. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-remote.c')
-rw-r--r--builtin-remote.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin-remote.c b/builtin-remote.c
index d032f2535..14774e36c 100644
--- a/builtin-remote.c
+++ b/builtin-remote.c
@@ -770,7 +770,7 @@ static int get_one_remote_for_update(struct remote *remote, void *priv)
{
struct string_list *list = priv;
if (!remote->skip_default_update)
- string_list_append(xstrdup(remote->name), list);
+ string_list_append(remote->name, list);
return 0;
}