Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Avoid segfault with 'git branch' when the HEAD is detached
author
Johannes Schindelin
<johannes.schindelin@gmx.de>
Wed, 18 Feb 2009 18:14:59 +0000
(19:14 +0100)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 18 Feb 2009 18:25:37 +0000
(10:25 -0800)
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>
builtin-branch.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
209d336
)
diff --git
a/builtin-branch.c
b/builtin-branch.c
index 7607f6ab9c612ef49b792f38a334374e11374e9c..6106a1abd5d5a001a44d06a66bc0ea2e47f5247d 100644
(file)
--- 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);