]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Martin Huter <mhuter@barracuda.com>
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 1 Feb 2011 01:55:04 +0000 (18:55 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 1 Feb 2011 01:55:04 +0000 (18:55 -0700)
Bug 3140: memory leak in error page generation

src/errorpage.cc

index 80d548431abd6e2327da0b6ef8b41100e1352a2b..cb5d50a07f25cc9c03ba53b5fe5ce641b05011b5 100644 (file)
@@ -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;
 }