From: Amos Jeffries Date: Tue, 1 Feb 2011 01:55:04 +0000 (-0700) Subject: Author: Martin Huter X-Git-Tag: SQUID_3_1_11~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc4d70797d9f5629a2d6c59cdc9b8a48bfb7e24a;p=thirdparty%2Fsquid.git Author: Martin Huter Bug 3140: memory leak in error page generation --- diff --git a/src/errorpage.cc b/src/errorpage.cc index 80d548431a..cb5d50a07f 100644 --- a/src/errorpage.cc +++ b/src/errorpage.cc @@ -940,6 +940,7 @@ ErrorState::BuildContent() String hdr; char dir[256]; int l = 0; + const char *freePage = NULL; /** error_directory option in squid.conf overrides translations. * Custom errors are always found either in error_directory or the templates directory. @@ -1013,6 +1014,7 @@ ErrorState::BuildContent() if (m) { /* store the language we found for the Content-Language reply header */ err_language = xstrdup(reset); + freePage = m; break; } else if (Config.errorLogMissingLanguages) { debugs(4, DBG_IMPORTANT, "WARNING: Error Pages Missing Language: " << reset); @@ -1064,5 +1066,9 @@ ErrorState::BuildContent() assert((size_t)content->contentSize() == strlen(content->content())); +#if USE_ERR_LOCALES + safe_free(freePage); +#endif + return content; }