Fix memory leak on char array