]> git.ipfire.org Git - thirdparty/git.git/commitdiff
http-push: free remote_ls_ctx.dentry_name
authorJeff King <peff@peff.net>
Tue, 24 Sep 2024 22:09:37 +0000 (18:09 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 25 Sep 2024 17:24:57 +0000 (10:24 -0700)
The remote_ls_ctx struct has dentry_name string, which is filled in with
a heap allocation in the handle_remote_ls_ctx() XML callback. After the
XML parse is done in remote_ls(), we should free the string to avoid a
leak.

This fixes several leaks found by running t5540.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http-push.c

index 8acdb3f2657d88aa93daa24a1d542a4683964246..2e1c6851bba5b9650373d9822438386c6280066e 100644 (file)
@@ -1183,6 +1183,7 @@ static void remote_ls(const char *path, int flags,
        }
 
        free(ls.path);
+       free(ls.dentry_name);
        free(url);
        strbuf_release(&out_buffer.buf);
        strbuf_release(&in_buffer);