summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2021-03-01 14:02:58 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-03-01 14:02:58 -0800
commit9889cff6d673b7dc2a699fa7f4470b2723e8d44a (patch)
tree3b8674149d08187e424eebfdfb63099b62e13541
parentMerge branch 'ns/raise-write-index-buffer-size' (diff)
parentdir: fix malloc of root untracked_cache_dir (diff)
downloadtgif-9889cff6d673b7dc2a699fa7f4470b2723e8d44a.tar.xz
Merge branch 'jh/untracked-cache-fix'
An under-allocation for the untracked cache data has been corrected. * jh/untracked-cache-fix: dir: fix malloc of root untracked_cache_dir
-rw-r--r--dir.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/dir.c b/dir.c
index d153a63bbd..fd8aa7c40f 100644
--- a/dir.c
+++ b/dir.c
@@ -2730,11 +2730,8 @@ static struct untracked_cache_dir *validate_untracked_cache(struct dir_struct *d
return NULL;
}
- if (!dir->untracked->root) {
- const int len = sizeof(*dir->untracked->root);
- dir->untracked->root = xmalloc(len);
- memset(dir->untracked->root, 0, len);
- }
+ if (!dir->untracked->root)
+ FLEX_ALLOC_STR(dir->untracked->root, name, "");
/* Validate $GIT_DIR/info/exclude and core.excludesfile */
root = dir->untracked->root;