Git development
 help / color / mirror / Atom feed
From: "Alex Riesen" <raa.lkml@gmail.com>
To: "Git Mailing List" <git@vger.kernel.org>
Cc: "Junio C Hamano" <gitster@pobox.com>
Subject: [PATCH] Fix handle leak in "git branch -D"
Date: Fri, 10 Aug 2007 15:06:57 +0200	[thread overview]
Message-ID: <81b0412b0708100606v7bcceaf6xc0783ea9761d7ba4@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 372 bytes --]

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?

[-- Attachment #2: 0001-Fix-handle-leak-in-git-branch-D.txt --]
[-- Type: text/plain, Size: 790 bytes --]

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


                 reply	other threads:[~2007-08-10 13:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=81b0412b0708100606v7bcceaf6xc0783ea9761d7ba4@mail.gmail.com \
    --to=raa.lkml@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox