From 55f0566f6d7269a56751333e0943b50237ce6a85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Fri, 17 Apr 2009 08:16:23 +1000 Subject: get_local_heads(): do not return random pointer if there is no head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Junio C Hamano --- remote.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'remote.c') diff --git a/remote.c b/remote.c index a06761ace8..e4c89b8b6d 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; } -- cgit v1.2.1