http: stop leaking buffer in http_get_info_packs()

We use http_get_strbuf() to fetch the remote info/packs content into a strbuf, but never free it, causing a leak. There's no need to hold onto it, as we've already parsed it completely. This lets us mark t5619 as leak-free. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Sep 24, 2024 at 18:02 UTC 75f4acc98125a9e9f5b3051c0dc6690839830e25
2 files changed +2
http.c
+1
@@ -2475,6 +2475,7 @@ int http_get_info_packs(const char *base_url, struct packed_git **packs_head)
2475
2476 cleanup:
2477 free(url);
2478 + strbuf_release(&buf);
2479 return ret;
2480 }
2481
t/t5619-clone-local-ambiguous-transport.sh
+1
@@ -2,6 +2,7 @@
2
3 test_description='test local clone with ambiguous transport'
4
5 +TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
7 . "$TEST_DIRECTORY/lib-httpd.sh"
8