# HG changeset patch # User Jim Meyering # Date 1263799404 -3600 # Node ID 7b2dc2e330511e657e64bada6e4293e65a43bd94 # Parent 366ef0bb3316f846bb24d39dfde68e450f5e43a1 getdate: don't leak when TZ contains two or more '"'s * lib/getdate.y (get_date): Don't leak a copy of TZ for each double quote in TZ after the first one. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2010-01-18 Jim Meyering + getdate: don't leak when TZ contains two or more '"'s + * lib/getdate.y (get_date): Don't leak a copy of TZ for each + double quote in TZ after the first one. + readtokens: do not leak internal token_lengths buffer * lib/readtokens.c (readtokens): Free the local, lengths, when the supplied "token_lengths" parameter is NULL. diff --git a/lib/getdate.y b/lib/getdate.y --- a/lib/getdate.y +++ b/lib/getdate.y @@ -1252,6 +1252,8 @@ char tz1buf[TZBUFSIZE]; bool large_tz = TZBUFSIZE < tzsize; bool setenv_ok; + /* Free tz0, in case this is the 2nd or subsequent time through. */ + free (tz0); tz0 = get_tz (tz0buf); z = tz1 = large_tz ? xmalloc (tzsize) : tz1buf; for (s = tzbase; *s != '"'; s++)