Fixed malloc() issues in test.