Fix memory leak in clear, and hinting