mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-22 20:43:02 +01:00
fixed "free(): invalid pointer" when XDG_CONFIG_HOME is set
This commit is contained in:
parent
0c3115e784
commit
9ac42daf2b
@ -107,7 +107,8 @@ char *get_user_config_dir(void)
|
||||
snprintf(user_config_dir, len, "%s/Library/Application Support", home);
|
||||
# else /* __APPLE__ */
|
||||
|
||||
if (!(user_config_dir = getenv("XDG_CONFIG_HOME"))) {
|
||||
const char *tmp;
|
||||
if (!(tmp = getenv("XDG_CONFIG_HOME"))) {
|
||||
len = strlen(home) + strlen("/.config") + 1;
|
||||
user_config_dir = malloc(len);
|
||||
|
||||
@ -116,6 +117,8 @@ char *get_user_config_dir(void)
|
||||
}
|
||||
|
||||
snprintf(user_config_dir, len, "%s/.config", home);
|
||||
} else {
|
||||
user_config_dir = strdup(tmp);
|
||||
}
|
||||
|
||||
# endif /* __APPLE__ */
|
||||
|
Loading…
Reference in New Issue
Block a user