1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-07-03 16:27:46 +02:00

Merge pull request #16 from gs93/invalid_pointer

fixed "free(): invalid pointer" when XDG_CONFIG_HOME is set
This commit is contained in:
JFreegman 2013-08-29 16:18:50 -07:00
commit 5fc6ab1c49

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