https://bugs.openldap.org/show_bug.cgi?id=10080
--- Comment #12 from Ondřej Kuzník ondra@mistotebe.net --- Working with your patch further, it seems test018 (and maybe others) are triggering memory issues: e.g. try compiling with `-DSLAP_NO_SL_MALLOC=1` and running `SLAPD_COMMON_WRAPPER=valgrind ./run test018` when in tests/. Looking at valgrind.* files under testrun will show that you might be freeing memory that's still being used later. Unfortunately I'm not sure what your testing configurations were when you saw the issues you're fixing so can't say for sure how the patch should be updated.
In general when dealing with memory safety and OpenLDAP, it is useful to build with -DSLAP_NO_SL_MALLOC=1 to make sure the operation's memory pool doesn't hide use-after-free or other issues that might exist/be introduced.
If you prefer, you can create a merge request on git.openldap.org and we can move over there. It does make it easier to reference specific parts of the code.