Pillow
Pillow copied to clipboard
Fix libtiff cleanup
Alternative to #8992
I've found that since #8954 was merged, there have been intermittent errors.
- 'cannot identify image file' - https://github.com/python-pillow/Pillow/actions/runs/15371601710/job/43251458128
- 'attempt to seek outside sequence' - https://github.com/python-pillow/Pillow/actions/runs/15370070907/job/43247953625
- 'unrecognized data stream contents when reading image file' - https://github.com/python-pillow/Pillow/actions/runs/15370070907/job/43247953635
Testing, I find that the minimal change to fix the problem is to restore one of the calls to TIFFCleanup, and then to set clientstate->tiff = NULL to prevent ImagingLibTiffEncodeCleanup from running afterwards.