]> git.ipfire.org Git - thirdparty/git.git/commitdiff
fetch-pack: clear pack lockfiles list
authorJeff King <peff@peff.net>
Tue, 24 Sep 2024 21:58:00 +0000 (17:58 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 25 Sep 2024 17:24:54 +0000 (10:24 -0700)
If the --lock-pack option is passed (which it typically is when
fetch-pack is used under the hood by smart-http), then we may end up
with entries in our pack_lockfiles string_list. We need to clear them
before returning to avoid a leak.

In git-fetch this isn't a problem, since the same cleanup happens via
transport_unlock_pack(). But the leak is detectable in t5551, which does
http fetches.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fetch-pack.c

index ef4143eef3c43fe444b229dc8322975259a74951..62e8c3aa6b8e8b2adc93edd5a3cbd9ecfb0bca75 100644 (file)
@@ -295,5 +295,6 @@ int cmd_fetch_pack(int argc,
        free_refs(remote_refs);
        list_objects_filter_release(&args.filter_options);
        oid_array_clear(&shallow);
+       string_list_clear(&pack_lockfiles, 0);
        return ret;
 }