1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-13 02:33:03 +01:00

fixed "free(): invalid pointer" when XDG_CONFIG_HOME is set

This commit is contained in:
Giuliano Schneider 2013-08-29 17:06:05 +02:00
parent 0c3115e784
commit 9ac42daf2b

View File

@ -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__ */