Fixed memory leaks with malformed PNG files.