threads / patch / 9471

patchFix handle leak in "git branch -D"

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

## tl;dr

One message between Aug 10, 2007 and Aug 10, 2007. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Alex Riesen· Aug 10, 2007, 13:06 UTC · lore
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>
---
 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@gmail.com>
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@gmail.com>
---
 refs.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Show changes to refs.c +1 −0
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

← back to recent threads