]> git.ipfire.org Git - thirdparty/git.git/commit - ref-filter.c
ref-filter: clear reachable list pointers after freeing
authorJeff King <peff@peff.net>
Mon, 10 Jul 2023 21:12:10 +0000 (17:12 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 10 Jul 2023 21:48:55 +0000 (14:48 -0700)
commit311bfe18ce8563d0b1b571e9dc9eb35b97de3790
tree5aabb2a74a8dd06565c005b7c7fe6bee991d9c3f
parentb9f7daa6ef52ad8894b5f730eaee0599668d66d5
ref-filter: clear reachable list pointers after freeing

In `reach_filter()`, we pop all commits from the reachable lists,
leaving them empty. But because we're operating on a list pointer that
was passed by value, the original `filter.reachable_from` and
`filter.unreachable_from` pointers are left dangling.

As is the case with the previous commit, nobody touches either of these
fields after calling `reach_filter()`, so leaving them dangling is OK.
But this future proofs against dangerous situations.

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>
ref-filter.c