diff options
Diffstat (limited to 'builtin-add.c')
-rw-r--r-- | builtin-add.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/builtin-add.c b/builtin-add.c index bfbbb1bf52..3a73a173f7 100644 --- a/builtin-add.c +++ b/builtin-add.c @@ -21,8 +21,7 @@ static void prune_directory(struct dir_struct *dir, const char **pathspec, int p for (specs = 0; pathspec[specs]; specs++) /* nothing */; - seen = xmalloc(specs); - memset(seen, 0, specs); + seen = xcalloc(specs, 1); src = dst = dir->entries; i = dir->nr; @@ -181,7 +180,7 @@ int cmd_add(int argc, const char **argv, char **envp) if (active_cache_changed) { if (write_cache(newfd, active_cache, active_nr) || - commit_lock_file(&lock_file)) + close(newfd) || commit_lock_file(&lock_file)) die("Unable to write new index file"); } |