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

[PATCH 2/4] make verify_one_pack() a bit less wrong wrt packed_git structure

From
Nicolas Pitre <nico@cam.org>
Date
Feb 28, 2008, 05:25 UTC
Message-ID
<1204176320-31358-3-git-send-email-nico@cam.org>
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
Previous: Nicolas PitreNext: Nicolas Pitre
Message 3 of 8 in “enhancements to 'git verify-pack'”
  1. 0/4 enhancements to 'git verify-pack'Nicolas Pitre, Feb 28, 2008
  2. 1/4 factorize revindex code out of builtin-pack-objects.cNicolas Pitre, Feb 28, 2008
  3. 2/4 make verify_one_pack() a bit less wrong wrt packed_git structureNicolas Pitre, Feb 28, 2008
  4. 3/4 fix unimplemented packed_object_info_detail() featuresNicolas Pitre, Feb 28, 2008
  5. 4/4 add storage size output to 'git verify-pack -v'Nicolas Pitre, Feb 28, 2008
  6. Junio C HamanoMar 1, 2008
  7. Nicolas PitreMar 1, 2008
  8. Junio C HamanoMar 1, 2008

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.