git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Alex Riesen <raa.lkml@gmail.com>
Date
Aug 10, 2007, 13:06 UTC
Message-ID
<81b0412b0708100606v7bcceaf6xc0783ea9761d7ba4@mail.gmail.com>
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(-)
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
Message 1 of 1 in “Fix handle leak in "git branch -D"”
  1. Fix handle leak in "git branch -D"Alex Riesen, Aug 10, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.