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>
This commit is contained in:
Johannes Sixt 2011-11-01 23:21:06 +01:00 коммит произвёл Junio C Hamano
Родитель 2548183bad
Коммит 395c73560b
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -74,7 +74,7 @@ static void hash_index_entry(struct index_state *istate, struct cache_entry *ce)
if (ce->ce_flags & CE_HASHED) if (ce->ce_flags & CE_HASHED)
return; return;
ce->ce_flags |= CE_HASHED; ce->ce_flags |= CE_HASHED;
ce->next = NULL; ce->next = ce->dir_next = NULL;
hash = hash_name(ce->name, ce_namelen(ce)); hash = hash_name(ce->name, ce_namelen(ce));
pos = insert_hash(hash, ce, &istate->name_hash); pos = insert_hash(hash, ce, &istate->name_hash);
if (pos) { if (pos) {