mirror of
https://github.com/shadps4-emu/ext-SDL.git
synced 2025-02-12 22:39:00 +00:00
Stack allocation never happened, so explicitly allocate the path
This commit is contained in:
parent
4836fd1e70
commit
7b14fcb4d9
@ -577,13 +577,11 @@ SDL_IOStream *SDL_IOFromFile(const char *file, const char *mode)
|
||||
return SDL_IOFromFP(fp, SDL_TRUE);
|
||||
} else {
|
||||
/* Try opening it from internal storage if it's a relative path */
|
||||
// !!! FIXME: why not just "char path[PATH_MAX];"
|
||||
char *path = SDL_stack_alloc(char, PATH_MAX);
|
||||
char *path = NULL;
|
||||
SDL_asprintf(&path, "%s/%s", SDL_AndroidGetInternalStoragePath(), file);
|
||||
if (path) {
|
||||
SDL_snprintf(path, PATH_MAX, "%s/%s",
|
||||
SDL_AndroidGetInternalStoragePath(), file);
|
||||
FILE *fp = fopen(path, mode);
|
||||
SDL_stack_free(path);
|
||||
SDL_free(path);
|
||||
if (fp) {
|
||||
if (!IsRegularFileOrPipe(fp)) {
|
||||
fclose(fp);
|
||||
|
Loading…
x
Reference in New Issue
Block a user