From 839f308d6011c9b5b8b460cb50dc2ed1c0ae4924 Mon Sep 17 00:00:00 2001 From: Albert Cahalan Date: Tue, 28 Dec 2004 16:12:48 +0000 Subject: [PATCH] note about putenv usage --- src/tuxpaint.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tuxpaint.c b/src/tuxpaint.c index 30c6b948a..b62008371 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -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 ? */ }