isage / sorr-vita

SoRR (BennuGD) vita port.
Other
41 stars 7 forks source link

New version of mod_sound with PSVita fixes #15

Closed danielt3 closed 2 years ago

danielt3 commented 2 years ago

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.

isage commented 2 years ago

Either you messed something up, or it changes nothing

danielt3 commented 2 years ago

I think it does changes some stuff.

image

isage commented 2 years ago

That does nothing functionally, except slightly reorganizing code

danielt3 commented 2 years ago

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.

isage commented 2 years ago

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

SplinterGU commented 2 years ago

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

SplinterGU commented 2 years ago

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...