You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by am...@apache.org on 2014/07/15 22:45:00 UTC
git commit: TS-1475: Fix leaked object in LogBuffer.cc.
Repository: trafficserver
Updated Branches:
refs/heads/master c43ed35e1 -> 3cecd886d
TS-1475: Fix leaked object in LogBuffer.cc.
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/3cecd886
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/3cecd886
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/3cecd886
Branch: refs/heads/master
Commit: 3cecd886d024bc693f1f1722f19a56899623f847
Parents: c43ed35
Author: Alan M. Carroll <am...@network-geographics.com>
Authored: Tue Jul 15 15:44:31 2014 -0500
Committer: Alan M. Carroll <am...@network-geographics.com>
Committed: Tue Jul 15 15:44:54 2014 -0500
----------------------------------------------------------------------
proxy/logging/LogBuffer.cc | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3cecd886/proxy/logging/LogBuffer.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogBuffer.cc b/proxy/logging/LogBuffer.cc
index c4a3cec..349aa77 100644
--- a/proxy/logging/LogBuffer.cc
+++ b/proxy/logging/LogBuffer.cc
@@ -659,6 +659,7 @@ LogBuffer::to_ascii(LogEntryHeader * entry, LogFormatType type,
int i;
LogFieldList *fieldlist = NULL;
+ bool delete_fieldlist_p = false; // need to free the fieldlist?
for (i = 0; i < fieldlist_cache_entries; i++) {
if (strcmp(symbol_str, fieldlist_cache[i].symbol_str) == 0) {
@@ -680,6 +681,8 @@ LogBuffer::to_ascii(LogEntryHeader * entry, LogFormatType type,
fieldlist_cache[fieldlist_cache_entries].fieldlist = fieldlist;
fieldlist_cache[fieldlist_cache_entries].symbol_str = ats_strdup(symbol_str);
fieldlist_cache_entries++;
+ } else {
+ delete_fieldlist_p = true;
}
}
@@ -725,6 +728,7 @@ LogBuffer::to_ascii(LogEntryHeader * entry, LogFormatType type,
delete alt_fieldlist;
ats_free(alt_printf_str);
ats_free(alt_symbol_str);
+ if (delete_fieldlist_p) delete fieldlist;
return ret;
}