mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-28 15:39:10 +00:00
Fix memory leak in SDL_IOFromFile()
If Android_JNI_FileOpen() or windows_file_open() fail, SDL_CloseIO(iostr) does nothing because 'iostr' is NULL and 'iodata' is leaked.
This commit is contained in:
parent
470cfc2755
commit
c226630086
1 changed files with 2 additions and 2 deletions
|
@ -600,7 +600,7 @@ SDL_IOStream *SDL_IOFromFile(const char *file, const char *mode)
|
|||
|
||||
void *iodata = NULL;
|
||||
if (Android_JNI_FileOpen(&iodata, file, mode) < 0) {
|
||||
SDL_CloseIO(iostr);
|
||||
Android_JNI_FileClose(iodata);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -629,7 +629,7 @@ SDL_IOStream *SDL_IOFromFile(const char *file, const char *mode)
|
|||
}
|
||||
|
||||
if (windows_file_open(iodata, file, mode) < 0) {
|
||||
SDL_CloseIO(iostr);
|
||||
windows_file_close(iodata);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue