Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
add_existing(): do not retain a reference to sha1
author
Michael Haggerty
<mhagger@alum.mit.edu>
Sat, 25 May 2013 09:08:17 +0000
(11:08 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Sun, 2 Jun 2013 22:28:47 +0000
(15:28 -0700)
Its lifetime is not guaranteed, so make a copy. Free the memory when
the string_list is cleared.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fetch.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
5b87d8d
)
diff --git
a/builtin/fetch.c
b/builtin/fetch.c
index 48df5fa4800431969ae8d237e9a7fac95ae0c169..fa6fe441471912e7011db14bcb901ae3f8d18a4d 100644
(file)
--- a/
builtin/fetch.c
+++ b/
builtin/fetch.c
@@
-571,7
+571,8
@@
static int add_existing(const char *refname, const unsigned char *sha1,
{
struct string_list *list = (struct string_list *)cbdata;
struct string_list_item *item = string_list_insert(list, refname);
{
struct string_list *list = (struct string_list *)cbdata;
struct string_list_item *item = string_list_insert(list, refname);
- item->util = (void *)sha1;
+ item->util = xmalloc(20);
+ hashcpy(item->util, sha1);
return 0;
}
return 0;
}
@@
-636,7
+637,7
@@
static void find_non_local_tags(struct transport *transport,
item = string_list_insert(&remote_refs, ref->name);
item->util = (void *)ref->old_sha1;
}
item = string_list_insert(&remote_refs, ref->name);
item->util = (void *)ref->old_sha1;
}
- string_list_clear(&existing_refs,
0
);
+ string_list_clear(&existing_refs,
1
);
/*
* We may have a final lightweight tag that needs to be
/*
* We may have a final lightweight tag that needs to be
@@
-782,7
+783,7
@@
static int do_fetch(struct transport *transport,
}
cleanup:
}
cleanup:
- string_list_clear(&existing_refs,
0
);
+ string_list_clear(&existing_refs,
1
);
return retcode;
}
return retcode;
}