From 05372c28bedbd2ae067e695805590b7eea947e10 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 24 Sep 2024 17:55:39 -0400 Subject: send-pack: free cas options before exit The send-pack --force-with-lease option populates a push_cas_option struct with allocated strings. Exiting without cleaning this up will cause leak-checkers to complain. We can fix this by calling clear_cas_option(), after making it publicly available. Previously it was used only for resetting the list when we saw --no-force-with-lease. The git-push command has the same "leak", though in this case it won't trigger a leak-checker since it stores the push_cas_option struct as a global rather than on the stack (and is thus reachable even after main() exits). I've added cleanup for it here anyway, though, as future-proofing. The leak is triggered by t5541 (it tests --force-with-lease over http, which requires a separate send-pack process under the hood), but we can't mark it as leak-free yet. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- builtin/send-pack.c | 1 + 1 file changed, 1 insertion(+) (limited to 'builtin/send-pack.c') diff --git a/builtin/send-pack.c b/builtin/send-pack.c index c49fe6c53c..8b1d46e79a 100644 --- a/builtin/send-pack.c +++ b/builtin/send-pack.c @@ -344,5 +344,6 @@ int cmd_send_pack(int argc, free_refs(local_refs); refspec_clear(&rs); oid_array_clear(&shallow); + clear_cas_option(&cas); return ret; } -- cgit 1.2.3-korg