libsdl-org / SDL_image

Image decoding for many popular formats for Simple Directmedia Layer.
zlib License
559 stars 182 forks source link

[2.8.x] Implement freedst exactly once when saving PNG and JPG files #430

Closed smcv closed 6 months ago

smcv commented 6 months ago

This fixes a memory leak when saving PNG and JPG files if SDL_image isn't built with save support.

This also fixes a double-free if saving with libjpeg or libpng fails and falls back to tinyjpeg or miniz.

(cherry picked from commit d2c7e09053287b091f55db11e296ff12962a2194)
(cherry picked from commit cf019d527ec2dc016ea500a4c03cd75bc6f8018b)
Resolves: https://github.com/libsdl-org/SDL_image/issues/428

slouken commented 6 months ago

I went ahead and directly cherry-picked the relevant change in b73cd7a