Fixed a memory leak, #valgrind-safe here