summaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2009-04-16 22:16:23 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-04-18 03:48:32 (GMT)
commit55f0566f6d7269a56751333e0943b50237ce6a85 (patch)
tree882e7400a1e085b19d31761d0066f515796acf60 /remote.c
parentf800b65bea1504299747e7be03ee279508a74e1f (diff)
downloadgit-55f0566f6d7269a56751333e0943b50237ce6a85.zip
git-55f0566f6d7269a56751333e0943b50237ce6a85.tar.gz
git-55f0566f6d7269a56751333e0943b50237ce6a85.tar.bz2
get_local_heads(): do not return random pointer if there is no head
it's silly to do this: mkdir foo && cd foo && git init && git push somewhere.git but segfault should not happen even in that case. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote.c')
-rw-r--r--remote.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/remote.c b/remote.c
index a06761a..e4c89b8 100644
--- a/remote.c
+++ b/remote.c
@@ -1504,7 +1504,7 @@ static int one_local_ref(const char *refname, const unsigned char *sha1, int fla
struct ref *get_local_heads(void)
{
- struct ref *local_refs, **local_tail = &local_refs;
+ struct ref *local_refs = NULL, **local_tail = &local_refs;
for_each_ref(one_local_ref, &local_tail);
return local_refs;
}