protocol-caps.c: fix memory leak in send_info()
commit88682b016dcbdbbdebdd2efd9b7de63e4395636f
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Tue, 31 Aug 2021 13:46:42 +0000 (31 15:46 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 31 Aug 2021 18:15:16 +0000 (31 11:15 -0700)
treeca0658b5f7e41691ac0b95d6257f424460047f97
parentd94f9b8e9049177d4148b57ecf5f44bfdcc4648d
protocol-caps.c: fix memory leak in send_info()

Fix a memory leak in a2ba162cda (object-info: support for retrieving
object info, 2021-04-20) which appears to have been based on a
misunderstanding of how the pkt-line.c API works. There is no need to
strdup() input to packet_writer_write(), it's just a printf()-like
format function.

This fixes a potentially large memory leak, since the number of OID
lines the "object-info" call can be arbitrarily large (or a small one
if the request is small).

This makes t5701-git-serve.sh pass again under SANITIZE=leak, as it
did before a2ba162cda2.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Acked-by: Bruno Albuquerque <bga@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
protocol-caps.c