]> git.ipfire.org Git - thirdparty/git.git/commit - ref-filter.c
ref-filter: add `ref_filter_clear()`
authorJeff King <peff@peff.net>
Mon, 10 Jul 2023 21:12:13 +0000 (17:12 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 10 Jul 2023 21:48:55 +0000 (14:48 -0700)
commitb571fb98008b485bfc6f7d6538b79a7e92d731f4
tree2837a8b21d55850720fab7e3a5dd42f53777e329
parent311bfe18ce8563d0b1b571e9dc9eb35b97de3790
ref-filter: add `ref_filter_clear()`

We did not bother to clean up at all in `git branch` or `git tag`, and
`git for-each-ref` only cleans up a couple of members.

Add and call `ref_filter_clear()` when cleaning up a `struct
ref_filter`. Running this patch (without any test changes) indicates a
couple of now leak-free tests. This was found by running:

    $ make SANITIZE=leak
    $ make -C t GIT_TEST_PASSING_SANITIZE_LEAK=check GIT_TEST_OPTS=--immediate

(Note that the `reachable_from` and `unreachable_from` lists should be
cleaned as they are used. So this is just covering any case where we
might bail before running the reachability check.)

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/branch.c
builtin/for-each-ref.c
builtin/tag.c
ref-filter.c
ref-filter.h
t/t0041-usage.sh
t/t3402-rebase-merge.sh