From: Nicolas Pitre Date: Thu, 28 Feb 2008 05:25:18 +0000 (-0500) Subject: make verify_one_pack() a bit less wrong wrt packed_git structure X-Git-Tag: v1.5.5-rc0~82^2~2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=340814636dde3cbd2e461b12f9ae832d2100766a;p=git.git make verify_one_pack() a bit less wrong wrt packed_git structure 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 Signed-off-by: Junio C Hamano --- diff --git a/builtin-verify-pack.c b/builtin-verify-pack.c index 4e31c273f..4958bbbf1 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; }