trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpe...@apache.org
Subject trafficserver git commit: Fix double-free in log object construction
Date Wed, 12 Aug 2015 16:35:29 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master d0cc04c2b -> b2006b44f


Fix double-free in log object construction


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/b2006b44
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/b2006b44
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/b2006b44

Branch: refs/heads/master
Commit: b2006b44fbe7af1edf2686b3248abebd297fac17
Parents: d0cc04c
Author: James Peach <jpeach@apache.org>
Authored: Wed Aug 12 09:35:02 2015 -0700
Committer: James Peach <jpeach@apache.org>
Committed: Wed Aug 12 09:35:02 2015 -0700

----------------------------------------------------------------------
 proxy/logging/Log.cc | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b2006b44/proxy/logging/Log.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc
index 03ef392..cad013e 100644
--- a/proxy/logging/Log.cc
+++ b/proxy/logging/Log.cc
@@ -1409,19 +1409,17 @@ Log::match_logobject(LogBufferHeader *header)
   if (!obj) {
     // object does not exist yet, create it
     //
-    LogFormat *fmt = new LogFormat("__collation_format__", header->fmt_fieldlist(), header->fmt_printf());
+    LogFormat fmt("__collation_format__", header->fmt_fieldlist(), header->fmt_printf());
 
-    if (fmt->valid()) {
+    if (fmt.valid()) {
       LogFileFormat file_format = header->log_object_flags & LogObject::BINARY ?
                                     LOG_FILE_BINARY :
                                     (header->log_object_flags & LogObject::WRITES_TO_PIPE
? LOG_FILE_PIPE : LOG_FILE_ASCII);
 
-      obj = new LogObject(fmt, Log::config->logfile_dir, header->log_filename(), file_format,
NULL,
+      obj = new LogObject(&fmt, Log::config->logfile_dir, header->log_filename(),
file_format, NULL,
                           (Log::RollingEnabledValues)Log::config->rolling_enabled, Log::config->collation_preproc_threads,
                           Log::config->rolling_interval_sec, Log::config->rolling_offset_hr,
Log::config->rolling_size_mb, true);
 
-      delete fmt; // This is copy constructed in LogObject.
-
       obj->set_remote_flag();
 
       if (Log::config->log_object_manager.manage_object(obj)) {
@@ -1432,7 +1430,7 @@ Log::match_logobject(LogBufferHeader *header)
         obj = NULL;
       }
     }
-    delete fmt;
   }
+
   return obj;
 }


Mime
View raw message