Merge "Fix valgrind gtests and memory leaks."