All memory leaks reported by valgrind have been removed.