Initialize lock_file struct to all zero.
hold_lock_file_for_update() relies on that. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Johannes Schindelin committed
Jun 20, 2006 at 00:55 UTC
928e47e3d50527adcfef20932f3b2764b9f11f06
2 files changed
+2
-2
builtin-update-index.c
+1
-1
@@ -490,7 +490,7 @@ int cmd_update_index(int argc, const char **argv, char **envp)
490
git_config(git_default_config);
491
492
/* We can't free this memory, it becomes part of a linked list parsed atexit() */
493
- lock_file = xmalloc(sizeof(struct lock_file));
493
+ lock_file = xcalloc(1, sizeof(struct lock_file));
494
495
newfd = hold_lock_file_for_update(lock_file, get_index_file());
496
if (newfd < 0)
builtin-write-tree.c
+1
-1
@@ -16,7 +16,7 @@ int write_tree(unsigned char *sha1, int missing_ok, const char *prefix)
16
int entries, was_valid, newfd;
17
18
/* We can't free this memory, it becomes part of a linked list parsed atexit() */
19
- struct lock_file *lock_file = xmalloc(sizeof(struct lock_file));
19
+ struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file));
20
21
newfd = hold_lock_file_for_update(lock_file, get_index_file());
22