1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 09:13:06 +00:00

#5920: Fix memory leak and access to freed memory in tr_getDefaultConfigDir (patch by jyelloz)

This commit is contained in:
Mike Gelfand 2015-04-05 06:39:06 +00:00
parent a8231b42f8
commit 7bfcbe55e1

View file

@ -330,10 +330,11 @@ tr_getDefaultConfigDir (const char * appname)
find_directory (B_USER_SETTINGS_DIRECTORY, -1, true, buf, sizeof (buf)); find_directory (B_USER_SETTINGS_DIRECTORY, -1, true, buf, sizeof (buf));
s = tr_buildPath (buf, appname, NULL); s = tr_buildPath (buf, appname, NULL);
#else #else
if ((s = tr_env_get_string ("XDG_CONFIG_HOME", NULL))) char * const xdg_config_home = tr_env_get_string ("XDG_CONFIG_HOME", NULL);
if (xdg_config_home != NULL)
{ {
s = tr_buildPath (s, appname, NULL); s = tr_buildPath (xdg_config_home, appname, NULL);
tr_free (s); tr_free (xdg_config_home);
} }
else else
{ {