Skip to content

Commit

Permalink
builtin-remote.c: plug a small memory leak in get_one_remote_for_upda…
Browse files Browse the repository at this point in the history
…tes()

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]>
  • Loading branch information
gitster committed Nov 17, 2008
1 parent 357af14 commit 83b7673
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion builtin-remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 83b7673

Please sign in to comment.