From fc4d70797d9f5629a2d6c59cdc9b8a48bfb7e24a Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Mon, 31 Jan 2011 18:55:04 -0700 Subject: [PATCH] Author: Martin Huter Bug 3140: memory leak in error page generation --- src/errorpage.cc | 6 ++++++ 1 file changed, 6 insertions(+) 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; } -- 2.47.2