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>
Junio C Hamano committed
Nov 17, 2008 at 07:54 UTC
83b767360a183abf29cb0cc0fd647fb683cff616
1 file changed
+1
-1
builtin-remote.c
+1
-1
@@ -770,7 +770,7 @@ static int get_one_remote_for_update(struct remote *remote, void *priv)
770
{
771
struct string_list *list = priv;
772
if (!remote->skip_default_update)
773
- string_list_append(xstrdup(remote->name), list);
773
+ string_list_append(remote->name, list);
774
return 0;
775
}
776