This is an automated email from the ASF dual-hosted git repository.

jpeach pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
       new  18670a3   TS-5037: Fix LogFormat object leak.
18670a3 is described below

commit 18670a3a35fc587d6b0ecf8a289f7ba17bda4986
Author: James Peach <[email protected]>
AuthorDate: Thu Nov 3 20:29:24 2016 -0700

    TS-5037: Fix LogFormat object leak.
---
 proxy/logging/LogConfig.cc | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/proxy/logging/LogConfig.cc b/proxy/logging/LogConfig.cc
index 994fb41..1461599 100644
--- a/proxy/logging/LogConfig.cc
+++ b/proxy/logging/LogConfig.cc
@@ -28,6 +28,8 @@
 #include <sys/param.h>
 #endif
 
+#include <memory>
+
 #include "ts/ink_platform.h"
 #include "ts/ink_file.h"
 
@@ -392,13 +394,13 @@ LogConfig::init(LogConfig *prev_config)
   // ----------------------------------------------------------------------
   // Construct a new error log object candidate.
   if (Log::error_logging_enabled()) {
-    LogFormat *fmt;
+    std::unique_ptr<LogFormat> fmt(MakeTextLogFormat("error"));
 
     Debug("log", "creating predefined error log object");
 
-    fmt    = MakeTextLogFormat("error");
-    errlog = new LogObject(fmt, logfile_dir, "error.log", LOG_FILE_ASCII, 
nullptr, (Log::RollingEnabledValues)rolling_enabled,
+    errlog = new LogObject(fmt.get(), logfile_dir, "error.log", 
LOG_FILE_ASCII, nullptr, (Log::RollingEnabledValues)rolling_enabled,
                            collation_preproc_threads, rolling_interval_sec, 
rolling_offset_hr, rolling_size_mb);
+
     log_object_manager.manage_object(errlog);
     errlog->set_fmt_timestamps();
   } else {

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to