[PATCH] Fix handle leak in "git branch -D"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 refs.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

BTW, why does not commit_lock_file takes care of closing the file
opened by hold_lock_file_for_update?
From 4e219bf5b2c7de091973336f6143f77fe9a96efc Mon Sep 17 00:00:00 2001
From: Alex Riesen <raa.lkml@xxxxxxxxx>
Date: Fri, 10 Aug 2007 15:06:22 +0200
Subject: [PATCH] Fix handle leak in "git branch -D"

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@xxxxxxxxx>
---
 refs.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/refs.c b/refs.c
index fac6548..09a2c87 100644
--- 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);
 }
 
-- 
1.5.3.rc4.81.gbd62


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux