Fix memory error in character editor