Fixed palindrome memory leaks