Fix various replication memleaks
The fix for ITS#9864 here is specific to 2.6, the corresponding patch in master would have a merge conflict which is why I've opened this MR against the 2.6 branch. The other commits are identical to master. The slapd-watcher commit is just here for convenience. I can split all these into separate MRs if that'd be better, but the 9864 commit still needs to be done explicitly for 2.6