Skip to content

Commit 83b7673

Browse files
committed
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 <[email protected]>
1 parent 357af14 commit 83b7673

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

builtin-remote.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ static int get_one_remote_for_update(struct remote *remote, void *priv)
770770
{
771771
struct string_list *list = priv;
772772
if (!remote->skip_default_update)
773-
string_list_append(xstrdup(remote->name), list);
773+
string_list_append(remote->name, list);
774774
return 0;
775775
}
776776

0 commit comments

Comments
 (0)