]> git.ipfire.org Git - thirdparty/git.git/commit
builtin/archive: fix leaking `OPT_FILENAME()` value
authorPatrick Steinhardt <ps@pks.im>
Thu, 22 Aug 2024 09:17:30 +0000 (11:17 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 22 Aug 2024 16:18:04 +0000 (09:18 -0700)
commit479601e9f4708a921e9bfad3a73e931cbed8817a
treef935fa3989f5d08b7164d5c0d84f232441c4c366
parent149c9e200c18316432a99a9b5edfa0d0b4d50bc5
builtin/archive: fix leaking `OPT_FILENAME()` value

The "--output" switch is an `OPT_FILENAME()` option, which allocates
memory when specified by the user. But while we free the string when
executed without the "--remote" switch, we don't otherwise because we
return via a separate exit path that doesn't know to free it.

Fix this by creating a common exit path.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/archive.c
t/t5000-tar-tree.sh
t/t5003-archive-zip.sh