Skip to content

Commit

Permalink
get_local_heads(): do not return random pointer if there is no head
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Nguyễn Thái Ngọc Duy authored and Junio C Hamano committed Apr 18, 2009
1 parent f800b65 commit 55f0566
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 55f0566

Please sign in to comment.