mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-11 20:44:24 +00:00
retroarch: Fix savefile directory memory leak
This commit is contained in:
parent
ac407588fa
commit
07b3a081c0
23
retroarch.c
23
retroarch.c
@ -405,19 +405,9 @@ static void retroarch_set_special_paths(char **argv, unsigned num_content)
|
||||
|
||||
const char *retroarch_get_current_savefile_dir(void)
|
||||
{
|
||||
char* ret = NULL;
|
||||
|
||||
if (!string_is_empty(current_savefile_dir))
|
||||
ret = current_savefile_dir;
|
||||
else
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
ret = strdup(global->name.base);
|
||||
path_basedir(ret);
|
||||
}
|
||||
char *ret = current_savefile_dir;
|
||||
|
||||
RARCH_LOG("Environ SAVE_DIRECTORY: \"%s\".\n",
|
||||
ret);
|
||||
RARCH_LOG("Environ SAVE_DIRECTORY: \"%s\".\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -517,6 +507,15 @@ static void retroarch_set_paths_redirect(const char *path)
|
||||
}
|
||||
}
|
||||
|
||||
/* Set savefile directory if empty based on content directory */
|
||||
if (string_is_empty(current_savefile_dir))
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
strlcpy(current_savefile_dir, global->name.base,
|
||||
sizeof(current_savefile_dir));
|
||||
path_basedir(current_savefile_dir);
|
||||
}
|
||||
|
||||
if(path_is_directory(current_savefile_dir))
|
||||
strlcpy(global->name.savefile, current_savefile_dir,
|
||||
sizeof(global->name.savefile));
|
||||
|
Loading…
Reference in New Issue
Block a user