Fix valgrind memory leak in table test