fetch: make own copies of refnames

Do not retain references to refnames passed to the each_ref_fn callback add_existing(), because their lifetime is not guaranteed. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michael Haggerty committed May 25, 2013 at 11:08 UTC b87dbcc89940edbf92cbab381001542a7cac3627
1 file changed +2 -2
builtin/fetch.c
+2 -2
@@ -590,7 +590,7 @@ static void find_non_local_tags(struct transport *transport,
590 struct ref **head,
591 struct ref ***tail)
592 {
593 - struct string_list existing_refs = STRING_LIST_INIT_NODUP;
593 + struct string_list existing_refs = STRING_LIST_INIT_DUP;
594 struct string_list remote_refs = STRING_LIST_INIT_NODUP;
595 const struct ref *ref;
596 struct string_list_item *item = NULL;
@@ -693,7 +693,7 @@ static int truncate_fetch_head(void)
693 static int do_fetch(struct transport *transport,
694 struct refspec *refs, int ref_count)
695 {
696 - struct string_list existing_refs = STRING_LIST_INIT_NODUP;
696 + struct string_list existing_refs = STRING_LIST_INIT_DUP;
697 struct string_list_item *peer_item = NULL;
698 struct ref *ref_map;
699 struct ref *rm;