diff --git a/update-index.c b/update-index.c
index 797245ab276543edc5d7605b57f5175278436234..1efac27c6baf26ed881099e91a3cbd5dbb3c2289 100644 (file)
--- a/update-index.c
+++ b/update-index.c
namelen = strlen(path);
size = cache_entry_size(namelen);
- ce = xmalloc(size);
- memset(ce, 0, size);
+ ce = xcalloc(1, size);
memcpy(ce->name, path, namelen);
ce->ce_flags = htons(namelen);
fill_stat_cache_info(ce, &st);
len = strlen(path);
size = cache_entry_size(len);
- ce = xmalloc(size);
- memset(ce, 0, size);
+ ce = xcalloc(1, size);
memcpy(ce->sha1, sha1, 20);
memcpy(ce->name, path, len);