http-backend.c: fix "dir" and "cmd_arg" leaks in cmd_main()
commiteef75d247a5f1ce07cb21fa05196cdf7bc443e13
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Mon, 6 Feb 2023 23:07:44 +0000 (7 00:07 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 6 Feb 2023 23:34:38 +0000 (6 15:34 -0800)
tree84a0bcfac88465ce8bde87b6a9c4e4712f12ed1d
parent9f24f3c719ccb4553f97a861c37cbedcc7357762
http-backend.c: fix "dir" and "cmd_arg" leaks in cmd_main()

Free the "dir" variable after we're done with it. Before
917adc03608 (http-backend: add GIT_PROJECT_ROOT environment var,
2009-10-30) there was no leak here, as we'd get it via getenv(), but
since 917adc03608 we've xstrdup()'d it (or the equivalent), so we need
to free() it.

We also need to free the "cmd_arg" variable, which has been leaked
ever since it was added in 2f4038ab337 (Git-aware CGI to provide dumb
HTTP transport, 2009-10-30).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http-backend.c