diff mbox series

[v3,01/22] builtin/ls-remote: plug leaking server options

Message ID fbb9e68e2f2039204a47b25c7a8d385cca04afbc.1730786196.git.ps@pks.im (mailing list archive)
State Accepted
Commit 5f5dd8e297b59f3f7bf61098e978a91c5581388a
Headers show
Series Memory leak fixes (pt.9) | expand

Commit Message

Patrick Steinhardt Nov. 5, 2024, 6:16 a.m. UTC
The list of server options populated via `OPT_STRING_LIST()` is never
cleared, causing a memory leak. Plug it.

This leak is exposed by t5702, but plugging it alone does not make the
whole test suite pass.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 builtin/ls-remote.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c
index f723b3bf3bb..f333821b994 100644
--- a/builtin/ls-remote.c
+++ b/builtin/ls-remote.c
@@ -166,6 +166,7 @@  int cmd_ls_remote(int argc,
 		status = 0; /* we found something */
 	}
 
+	string_list_clear(&server_options, 0);
 	ref_sorting_release(sorting);
 	ref_array_clear(&ref_array);
 	if (transport_disconnect(transport))