freed all memory valgrind passed