Fixed memoru leak in unit tests.