Closed danielt3 closed 2 years ago
Either you messed something up, or it changes nothing
I think it does changes some stuff.
That does nothing functionally, except slightly reorganizing code
It is not just reorganizing code: if SDL_RWFromBGDFP
fails but Mix_LoadWAV_RW
doesn't, file_close won't be called and fp
will leak. In other words, we have to test the return of SDL_RWFromBGDFP
before moving on with the execution and handle this failure (if some) before doing other things.
Mix_LoadWAV_RW will fail if SDL_RWFromBGDFP fails (because when it fails it returns NULL). See https://github.com/libsdl-org/SDL_mixer/blob/release-2.0.4/mixer.c#L681
Mix_LoadWAV_RW will fail if SDL_RWFromBGDFP fails (because when it fails it returns NULL). See https://github.com/libsdl-org/SDL_mixer/blob/release-2.0.4/mixer.c#L681
If the Mix_LoadWAV_RW fail for null rw_ops argument then it don't release the file handle (file_close), if it fail later (in the load) then it do a file_close... Then Is wong that you in mod_sound.c do a file_close allways that it fail... The patch Is needed.. if you do file_close if it fail, you'll generate double file_close AND a crash... Please apply the fix... Thanks
That does nothing functionally, except slightly reorganizing code
Isn't only reorganizing code... It's needed, because sdl_mixer don't manage the errors good...
This version of mod_sound was created by the original BennuGD author and fixes a number of issues in the PSVita version.
Please, review and merge it.