name-hash.c: always initialize dir_next pointer
Test t2021-checkout-overwrite.sh reveals a segfault in 'git add' on a case-insensitive file system when git is compiled with XMALLOC_POISON defined. The reason is that 2548183b (fix phantom untracked files when core.ignorecase is set) added a new member dir_next to struct cache_entry, but forgot to initialize it in all cases. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Sixt committed
Nov 1, 2011 at 23:21 UTC
395c73560b3716a1f74124826b80ab7ec47d7cd8
1 file changed
+1
-1
name-hash.c
+1
-1
@@ -74,7 +74,7 @@ static void hash_index_entry(struct index_state *istate, struct cache_entry *ce)
74
if (ce->ce_flags & CE_HASHED)
75
return;
76
ce->ce_flags |= CE_HASHED;
77
- ce->next = NULL;
77
+ ce->next = ce->dir_next = NULL;
78
hash = hash_name(ce->name, ce_namelen(ce));
79
pos = insert_hash(hash, ce, &istate->name_hash);
80
if (pos) {