I have re-tested this with testcopy with MapServer 4.10.0, 4.10.1 and 5.0-beta2 and cannot reproduce the free() errors reported in this ticket with any version. The only memory issue I could find with Valgrind was an uninitialised memory access in v5.0.0-beta2 which I documented and fixed in ticket #2194 and is most likely unrelated.
In all cases I was using the following options:
./configure --with-gd=../gd-2.0.35 --with-proj=/usr/ --enable-debug
Since we cannot reproduce this issue, and nobody reported similar issues with MapServer since 4.10.0 we have to conclude that the problem is not with MapServer but with the build environment that has something specific that we can't find that triggers some memory management issues.
Closing as worksforme. Sorry. :(