fix: destroy QueryCache.CacheEntry objects on clean-up

This commit is contained in:
CJ van den Berg 2025-03-19 15:32:40 +01:00
parent d5d7a9bb80
commit 90695e9dc6
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -75,11 +75,13 @@ fn release_ref_unlocked_and_maybe_destroy(self: *Self) void {
while (iter_highlights.next()) |p| {
self.allocator.free(p.key_ptr.*);
if (p.value_ptr.*.query) |q| q.destroy();
self.allocator.destroy(p.value_ptr.*);
}
var iter_injections = self.injections.iterator();
while (iter_injections.next()) |p| {
self.allocator.free(p.key_ptr.*);
if (p.value_ptr.*.query) |q| q.destroy();
self.allocator.destroy(p.value_ptr.*);
}
self.highlights.deinit(self.allocator);
self.injections.deinit(self.allocator);