From: Lee Date: Sat, 23 Jul 2016 23:05:15 +0000 (+0000) Subject: so the next person doesn't waste any time wondering why X-Git-Tag: v_3_0_26~45 X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=commitdiff_plain;h=ff46b9e19a67ee852e9a6c1e2a5d63fb695a9028 so the next person doesn't waste any time wondering why it's only on Windows that the memory gets freed --- diff --git a/miscutil.c b/miscutil.c index f5e647ca..10ff9ead 100644 --- a/miscutil.c +++ b/miscutil.c @@ -1,4 +1,4 @@ -const char miscutil_rcs[] = "$Id: miscutil.c,v 1.80 2016/01/16 12:33:36 fabiankeil Exp $"; +const char miscutil_rcs[] = "$Id: miscutil.c,v 1.81 2016/02/26 12:29:17 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/miscutil.c,v $ @@ -893,6 +893,16 @@ time_t timegm(struct tm *tm) strcat(old_zone, zone); putenv(old_zone); #ifdef _WIN32 + /* http://man7.org/linux/man-pages/man3/putenv.3.html + * int putenv(char *string); + * The string pointed to by string becomes part of the environment, so altering the + * string changes the environment. + * In other words, the memory pointed to by *string is used until + * a) another call to putenv() with the same e-var name + * b) the program exits + * + * Windows e-vars don't work that way, so let's not leak memory. + */ free(old_zone); #endif /* def _WIN32 */ }