note about putenv usage

This commit is contained in:
Albert Cahalan 2004-12-28 16:12:48 +00:00
parent e2bc612730
commit 839f308d60

View file

@ -1190,6 +1190,9 @@ static void do_locale_option(const char * const arg)
char *str = malloc(len);
snprintf(str, len, "LANG=%s", arg);
putenv(str);
// We leak "str" because it can not be freed. It is now part
// of the environment. If it were local, the environment would
// get corrupted.
setlocale(LC_ALL, ""); /* use arg ? */
}