summaryrefslogtreecommitdiffstats
path: root/oss-fuzz
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2024-06-25 19:40:15 +0200
committerJunio C Hamano <gitster@pobox.com>2024-06-25 22:52:06 +0200
commit9c8a9ec787149dc4f4b278d9bd8ad94c96691a5f (patch)
treeaa85a3b02f7778ae2db9d9c8af222d9fcf241680 /oss-fuzz
parentcommit-graph: reuse existing Bloom filters where possible (diff)
downloadgit-9c8a9ec787149dc4f4b278d9bd8ad94c96691a5f.tar.xz
git-9c8a9ec787149dc4f4b278d9bd8ad94c96691a5f.zip
bloom: introduce `deinit_bloom_filters()`
After we are done using Bloom filters, we do not currently clean up any memory allocated by the commit slab used to store those filters in the first place. Besides the bloom_filter structures themselves, there is mostly nothing to free() in the first place, since in the read-only path all Bloom filter's `data` members point to a memory mapped region in the commit-graph file itself. But when generating Bloom filters from scratch (or initializing truncated filters) we allocate additional memory to store the filter's data. Keep track of when we need to free() this additional chunk of memory by using an extra pointer `to_free`. Most of the time this will be NULL (indicating that we are representing an existing Bloom filter stored in a memory mapped region). When it is non-NULL, free it before discarding the Bloom filters slab. Suggested-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'oss-fuzz')
0 files changed, 0 insertions, 0 deletions