Be stricter on valgrind leak checks and fix them
We used to ignore leaks, and we are ending up in having various of them (including ones fixed in !391 (merged)), so let's make valgrind to exit with error when using the valgrind test setup (so in CI) to catch them better.
We had various memory errors, so let's tackle them all.
Edited by Marco Trevisan