Code

Fix filehandle leak in "git branch -D"
authorAlex Riesen <raa.lkml@gmail.com>
Fri, 10 Aug 2007 13:06:22 +0000 (15:06 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sat, 11 Aug 2007 05:50:06 +0000 (22:50 -0700)
On Windows (it can't touch open files in any way) the following fails:

    git branch -D branch1 branch2

if the both branches are in packed-refs.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs.c

diff --git a/refs.c b/refs.c
index fac6548001068b15739065d04e343c8730e8c3de..09a2c87fc23e4298bb3bcddc5c2cc649c3206a04 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -869,6 +869,7 @@ static int repack_without_ref(const char *refname)
                        die("too long a refname '%s'", list->name);
                write_or_die(fd, line, len);
        }
+       close(fd);
        return commit_lock_file(&packlock);
 }