https://bugs.openldap.org/show_bug.cgi?id=10518
--- Comment #2 from Howard Chu hyc@openldap.org --- Thanks for the report. This bug was introduced in 10161b20fef84de5a07afdcbce3b59aea1123a6e for ITS#10395.
Unfortunately your patch will also leak mutexes when nested write transactions are used. We'll have to work out a different fix.