{"thread":{"id":"4571","subject":"[PATCH] Initialize lock_file struct to all zero.","startedAt":"2006-06-19T22:55:20Z","lastAt":"2006-06-20T00:04:36Z","messageCount":2,"participants":["Johannes Schindelin","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"22080","messageId":"Pine.LNX.4.63.0606200054290.26329@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"4571","inReplyTo":null,"subject":"[PATCH] Initialize lock_file struct to all zero.","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-06-19T22:55:20Z","receivedAt":"2006-06-19T22:55:20Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nhold_lock_file_for_update() relies on that.\n\nSigned-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n\n---\n\n\tBugs like this drive you crazy. You make a little change elsewhere,\n\tand all of a sudden, a test of git-update-index fails (since the \n\tlock file is never removed).\n\n builtin-update-index.c |    2 +-\n builtin-write-tree.c   |    2 +-\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin-update-index.c b/builtin-update-index.c\nindex 325cd09..829ed23 100644\n--- a/builtin-update-index.c\n+++ b/builtin-update-index.c\n@@ -490,7 +490,7 @@ int cmd_update_index(int argc, const cha\n \tgit_config(git_default_config);\n \n \t/* We can't free this memory, it becomes part of a linked list parsed atexit() */\n-\tlock_file = xmalloc(sizeof(struct lock_file));\n+\tlock_file = xcalloc(1, sizeof(struct lock_file));\n \n \tnewfd = hold_lock_file_for_update(lock_file, get_index_file());\n \tif (newfd < 0)\ndiff --git a/builtin-write-tree.c b/builtin-write-tree.c\nindex c3aac36..8c151da 100644\n--- a/builtin-write-tree.c\n+++ b/builtin-write-tree.c\n@@ -16,7 +16,7 @@ int write_tree(unsigned char *sha1, int \n \tint entries, was_valid, newfd;\n \n \t/* We can't free this memory, it becomes part of a linked list parsed atexit() */\n-\tstruct lock_file *lock_file = xmalloc(sizeof(struct lock_file));\n+\tstruct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file));\n \n \tnewfd = hold_lock_file_for_update(lock_file, get_index_file());\n \n-- \n1.4.0.g9833\n"},{"id":"22086","messageId":"7vr71k7kvf.fsf@assigned-by-dhcp.cox.net","threadId":"4571","inReplyTo":"Pine.LNX.4.63.0606200054290.26329@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] Initialize lock_file struct to all zero.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-06-20T00:04:36Z","receivedAt":"2006-06-20T00:04:36Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Good catch.  Thanks.\n"}]}