mirror of
https://github.com/Cisco-Talos/clamav.git
synced 2026-05-07 23:26:27 -04:00
This is a cherry-pick of a similar commit on the bytecode branch. There this was needed because the JIT stores pointers mangled (stores an integer in low bits of the pointer), thus valgrind can't see that pointers to that memory region still exist, and reports it as definetely lost, instead of still reachable. However this seems to happen on master too (where there is no JIT), valgrind cannot see that everything allocating in engine is reachable from the engine pointer, and reports some of the memory allocated for the engine (the regex parts) as possible lost, and reports the rest as still reachable. This seems to only happen with certain kernel versions, timings, etc. The fix is to always free the engine, even if this is the parent after the fork.