You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2015/05/29 02:22:08 UTC

[1/2] trafficserver git commit: TS-3635 Fix some ASAN memory issues

Repository: trafficserver
Updated Branches:
  refs/heads/master a266f6a5a -> 4ce075de8


TS-3635 Fix some ASAN memory issues


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

Branch: refs/heads/master
Commit: b39cd80de47d4034b1574f6b8b3da92721e5d8b2
Parents: a266f6a
Author: Leif Hedstrom <zw...@apache.org>
Authored: Sat May 23 20:19:11 2015 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Thu May 28 18:20:44 2015 -0600

----------------------------------------------------------------------
 iocore/cache/CacheTest.cc    | 4 ++--
 proxy/InkAPITest.cc          | 6 +++---
 proxy/congest/MT_hashtable.h | 2 +-
 proxy/hdrs/HdrTest.cc        | 3 ++-
 4 files changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b39cd80d/iocore/cache/CacheTest.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheTest.cc b/iocore/cache/CacheTest.cc
index 2a74e77..fb55123 100644
--- a/iocore/cache/CacheTest.cc
+++ b/iocore/cache/CacheTest.cc
@@ -481,11 +481,11 @@ test_RamCache(RegressionTest *t, RamCache *cache)
 
   for (int l = 0; l < 10; l++) {
     for (int i = 0; i < 200; i++) {
-      IOBufferData *d = new IOBufferData;
+      IOBufferData *d = new (ats_malloc(sizeof(IOBufferData))) IOBufferData;
       INK_MD5 md5;
 
       d->alloc(BUFFER_SIZE_INDEX_16K);
-      data.push_back(Ptr<IOBufferData>(d));
+      data.push_back(make_ptr(d));
       md5.u64[0] = ((uint64_t)i << 32) + i;
       md5.u64[1] = ((uint64_t)i << 32) + i;
       cache->put(&md5, data[i], 1 << 15);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b39cd80d/proxy/InkAPITest.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc
index 200759e..1eeaa75 100644
--- a/proxy/InkAPITest.cc
+++ b/proxy/InkAPITest.cc
@@ -5018,8 +5018,8 @@ REGRESSION_TEST(SDK_API_TSMimeHdrParse)(RegressionTest *test, int /* atype ATS_U
 REGRESSION_TEST(SDK_API_TSUrlParse)(RegressionTest *test, int /* atype ATS_UNUSED */, int *pstatus)
 {
   static char const *const urls[] = {
-    "file:///test.dat;ab?abc=def#abc", "http://www.example.com", "http://abc:def@www.example.com", "http://www.example.com:3426",
-    "http://abc:def@www.example.com:3426", "http://www.example.com/homepage.cgi",
+    "file:///test.dat;ab?abc=def#abc", "http://www.example.com/", "http://abc:def@www.example.com/", "http://www.example.com:3426/",
+    "http://abc:def@www.example.com:3426/", "http://www.example.com/homepage.cgi",
     "http://www.example.com/homepage.cgi;ab?abc=def#abc", "http://abc:def@www.example.com:3426/homepage.cgi;ab?abc=def#abc",
     "https://abc:def@www.example.com:3426/homepage.cgi;ab?abc=def#abc",
     "ftp://abc:def@www.example.com:3426/homepage.cgi;ab?abc=def#abc",
@@ -5057,7 +5057,7 @@ REGRESSION_TEST(SDK_API_TSUrlParse)(RegressionTest *test, int /* atype ATS_UNUSE
       }
     } else {
       start = url;
-      end = url + strlen(url) + 1;
+      end = url + strlen(url);
       if ((retval = TSUrlParse(bufp, url_loc, &start, end)) == TS_PARSE_ERROR) {
         SDK_RPRINT(test, "TSUrlParse", url, TC_FAIL, "TSUrlParse returns TS_PARSE_ERROR");
       } else {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b39cd80d/proxy/congest/MT_hashtable.h
----------------------------------------------------------------------
diff --git a/proxy/congest/MT_hashtable.h b/proxy/congest/MT_hashtable.h
index d45afc3..32969b6 100644
--- a/proxy/congest/MT_hashtable.h
+++ b/proxy/congest/MT_hashtable.h
@@ -157,7 +157,7 @@ public:
             prev->next = next;
           else
             buckets[i] = next;
-          delete cur;
+          ats_free(cur);
           cur_size--;
         } else {
           prev = cur;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b39cd80d/proxy/hdrs/HdrTest.cc
----------------------------------------------------------------------
diff --git a/proxy/hdrs/HdrTest.cc b/proxy/hdrs/HdrTest.cc
index 6ec17eb..583136d 100644
--- a/proxy/hdrs/HdrTest.cc
+++ b/proxy/hdrs/HdrTest.cc
@@ -1262,7 +1262,6 @@ HdrTest::test_http_hdr_print_and_copy_aux(int testnum, const char *request, cons
   marshal_hdr.unmarshal(marshal_buf, marshal_len, &ref);
   new_hdr.create(HTTP_TYPE_REQUEST);
   new_hdr.copy(&marshal_hdr);
-  ats_free(marshal_buf);
 
   /*** (3) print the request header and copy to buffers ***/
 
@@ -1272,6 +1271,8 @@ HdrTest::test_http_hdr_print_and_copy_aux(int testnum, const char *request, cons
   cpy_bufindex = cpy_dumpoffset = 0;
   cpy_ret = new_hdr.print(cpy_buf, cpy_bufsize, &cpy_bufindex, &cpy_dumpoffset);
 
+  ats_free(marshal_buf);
+
   if ((prt_ret != 1) || (cpy_ret != 1)) {
     printf("FAILED: (test #%d) couldn't print req hdr or copy --- prt_ret=%d, cpy_ret=%d\n", testnum, prt_ret, cpy_ret);
     return (0);


[2/2] trafficserver git commit: Add TS-3635

Posted by zw...@apache.org.
Add TS-3635


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

Branch: refs/heads/master
Commit: 4ce075de8666880498829d91473579f810333153
Parents: b39cd80
Author: Leif Hedstrom <zw...@apache.org>
Authored: Thu May 28 18:21:20 2015 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Thu May 28 18:21:20 2015 -0600

----------------------------------------------------------------------
 CHANGES | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/4ce075de/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 88694bc..4755a6b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 6.0.0
   
+  *) [TS-3635] Fix some ASAN memory issues.
+
   *) [TS-3642]: fix reading of proxy.config.http.share_server_sessions.
 
   *) [TS-3631] Add config option to limit post size.