[WIP] valgrind tests for geometry.c

There are a couple more bugs.