Further insert-molecules cleanup

- Run insert-molecules tests under valgrind, and fix (most) memory
  leaks.
- Clarify memory management by moving memory allocation of some arrays
  into functions where they are actually used.
- More sensible status output.
- Additional tests.

Change-Id: I7bc2f7b4b155ac650235da00b414561b963d347c