git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Pitre <nico@cam.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: [PATCH 2/4] make verify_one_pack() a bit less wrong wrt packed_git structure
Date: Thu, 28 Feb 2008 00:25:18 -0500	[thread overview]
Message-ID: <1204176320-31358-3-git-send-email-nico@cam.org> (raw)
In-Reply-To: <1204176320-31358-2-git-send-email-nico@cam.org>

Simply freeing it is wrong.  There are many things attached to this
structure that are not cleaned up.  In practice this doesn't matter much
since this happens just before the program exits, but it is still
a bit more "correct" to leak it implicitly rather than explicitly.

And therefore it is also a good idea to register it with
install_packed_git().  Not only might it have better chance of being
properly cleaned up if such functionality is implemented for the general
case, but some functions like init_revindex() expect all packed_git
instances to be globally accessible.

Signed-off-by: Nicolas Pitre <nico@cam.org>
---
 builtin-verify-pack.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/builtin-verify-pack.c b/builtin-verify-pack.c
index 4e31c27..4958bbb 100644
--- a/builtin-verify-pack.c
+++ b/builtin-verify-pack.c
@@ -40,8 +40,8 @@ static int verify_one_pack(const char *path, int verbose)
 	if (!pack)
 		return error("packfile %s not found.", arg);
 
+	install_packed_git(pack);
 	err = verify_pack(pack, verbose);
-	free(pack);
 
 	return err;
 }
-- 
1.5.4.2.200.g99e75

  reply	other threads:[~2008-02-28  5:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-28  5:25 [PATCH 0/4] enhancements to 'git verify-pack' Nicolas Pitre
2008-02-28  5:25 ` [PATCH 1/4] factorize revindex code out of builtin-pack-objects.c Nicolas Pitre
2008-02-28  5:25   ` Nicolas Pitre [this message]
2008-02-28  5:25     ` [PATCH 3/4] fix unimplemented packed_object_info_detail() features Nicolas Pitre
2008-02-28  5:25       ` [PATCH 4/4] add storage size output to 'git verify-pack -v' Nicolas Pitre
2008-03-01  5:59     ` [PATCH 2/4] make verify_one_pack() a bit less wrong wrt packed_git structure Junio C Hamano
2008-03-01  8:18       ` Nicolas Pitre
2008-03-01 20:25         ` Junio C Hamano

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=1204176320-31358-3-git-send-email-nico@cam.org \
    --to=nico@cam.org \
    --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;
as well as URLs for NNTP newsgroup(s).