diff options
author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2009-02-18 19:14:59 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-02-18 10:25:37 -0800 |
commit | 45e2b6140147d7a8b2cd68399e4d52d5d8d7b5be (patch) | |
tree | e66190700463bfaa2d287f3f631d04402d5d1f3b /builtin-branch.c | |
parent | 209d336ae3923f2c1783a42b12fca50f3bee0802 (diff) | |
download | git-45e2b6140147d7a8b2cd68399e4d52d5d8d7b5be.tar.gz git-45e2b6140147d7a8b2cd68399e4d52d5d8d7b5be.tar.xz |
Avoid segfault with 'git branch' when the HEAD is detached
A recent addition to the ref_item struct was not taken care of, leading
to a segmentation fault when accessing the (uninitialized) "dest" member.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-branch.c')
-rw-r--r-- | builtin-branch.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin-branch.c b/builtin-branch.c index 7607f6ab9..6106a1abd 100644 --- a/builtin-branch.c +++ b/builtin-branch.c @@ -432,7 +432,9 @@ static void print_ref_list(int kinds, int detached, int verbose, int abbrev, str is_descendant_of(head_commit, with_commit)) { struct ref_item item; item.name = xstrdup("(no branch)"); + item.len = strlen(item.name); item.kind = REF_LOCAL_BRANCH; + item.dest = NULL; item.commit = head_commit; if (strlen(item.name) > ref_list.maxwidth) ref_list.maxwidth = strlen(item.name); |