X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=update-index.c;h=1efac27c6baf26ed881099e91a3cbd5dbb3c2289;hb=7d09fbe4ab7f080a8f8f5dcef7e0f3edf5e26019;hp=797245ab276543edc5d7605b57f5175278436234;hpb=a41c175d6f3e903844131b6dc39da986248c7585;p=git.git diff --git a/update-index.c b/update-index.c index 797245ab..1efac27c 100644 --- a/update-index.c +++ b/update-index.c @@ -114,8 +114,7 @@ static int add_file_to_cache(const char *path) 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); @@ -312,8 +311,7 @@ static int add_cacheinfo(unsigned int mode, const unsigned char *sha1, 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);