mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 19:04:58 +00:00
We have to be careful to always destroy the jpeglib decompression struct before returning from JPEGLoadingContext::decode. We were doing this in jpeglib error handlers, but we have a couple of paths that bail from the decoder via TRY. These paths were neither cleaning up memory nor setting the image decoder to an error state. So this patch sets up a scope guard to ensure we free the decompressor upon exit from the function. And it delegates the responsibility of setting the decoder state to the caller (of which there is only one), to ensure all error paths result in an error state.
7.2 KiB
7.2 KiB