trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sudhe...@apache.org
Subject trafficserver git commit: Fix Resource leak in HTTP2 tests
Date Wed, 07 Jan 2015 17:51:49 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master 175c2644b -> faefdc4f5


Fix Resource leak in HTTP2 tests

Coverity CID 1254822


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

Branch: refs/heads/master
Commit: faefdc4f594cf8faf094a219e678248a749b61c1
Parents: 175c264
Author: Sudheer Vinukonda <sudheerv@yahoo-inc.com>
Authored: Wed Jan 7 17:50:59 2015 +0000
Committer: Sudheer Vinukonda <sudheerv@yahoo-inc.com>
Committed: Wed Jan 7 17:50:59 2015 +0000

----------------------------------------------------------------------
 proxy/http2/HTTP2.cc | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/faefdc4f/proxy/http2/HTTP2.cc
----------------------------------------------------------------------
diff --git a/proxy/http2/HTTP2.cc b/proxy/http2/HTTP2.cc
index 4991dd2..62180de 100644
--- a/proxy/http2/HTTP2.cc
+++ b/proxy/http2/HTTP2.cc
@@ -595,7 +595,7 @@ REGRESSION_TEST(HPACK_EncodeLiteralHeaderField)(RegressionTest * t, int,
int *ps
   for (unsigned int i=0; i<sizeof(literal_test_case)/sizeof(literal_test_case[0]); i++)
{
     memset(buf, 0, BUFSIZE_FOR_REGRESSION_TEST);
 
-    HTTPHdr* headers = new HTTPHdr();
+    ats_scoped_obj<HTTPHdr> headers(new HTTPHdr);
     headers->create(HTTP_TYPE_RESPONSE);
     MIMEField *field = mime_field_create(headers->m_heap, headers->m_http->m_fields_impl);
     MIMEFieldWrapper header(field, headers->m_heap, headers->m_http->m_fields_impl);
@@ -624,7 +624,7 @@ REGRESSION_TEST(HPACK_Encode)(RegressionTest * t, int, int *pstatus)
 
   // FIXME Current encoder don't support indexing.
   for (unsigned int i=0; i<sizeof(encoded_field_test_case)/sizeof(encoded_field_test_case[0]);
i++) {
-    HTTPHdr* headers = new HTTPHdr();
+    ats_scoped_obj<HTTPHdr> headers(new HTTPHdr);
     headers->create(HTTP_TYPE_REQUEST);
 
     for (unsigned int j=0; j<sizeof(raw_field_test_case[i])/sizeof(raw_field_test_case[i][0]);
j++) {
@@ -699,7 +699,7 @@ REGRESSION_TEST(HPACK_DecodeIndexedHeaderField)(RegressionTest * t, int,
int *ps
   Http2HeaderTable header_table;
 
   for (unsigned int i=0; i<sizeof(indexed_test_case)/sizeof(indexed_test_case[0]); i++)
{
-    HTTPHdr* headers = new HTTPHdr();
+    ats_scoped_obj<HTTPHdr> headers(new HTTPHdr);
     headers->create(HTTP_TYPE_REQUEST);
     MIMEField *field = mime_field_create(headers->m_heap, headers->m_http->m_fields_impl);
     MIMEFieldWrapper header(field, headers->m_heap, headers->m_http->m_fields_impl);
@@ -730,7 +730,7 @@ REGRESSION_TEST(HPACK_DecodeLiteralHeaderField)(RegressionTest * t, int,
int *ps
   Http2HeaderTable header_table;
 
   for (unsigned int i=0; i<sizeof(literal_test_case)/sizeof(literal_test_case[0]); i++)
{
-    HTTPHdr* headers = new HTTPHdr();
+    ats_scoped_obj<HTTPHdr> headers(new HTTPHdr);
     headers->create(HTTP_TYPE_REQUEST);
     MIMEField *field = mime_field_create(headers->m_heap, headers->m_http->m_fields_impl);
     MIMEFieldWrapper header(field, headers->m_heap, headers->m_http->m_fields_impl);
@@ -761,7 +761,7 @@ REGRESSION_TEST(HPACK_Decode)(RegressionTest * t, int, int *pstatus)
   Http2HeaderTable header_table;
 
   for (unsigned int i=0; i<sizeof(encoded_field_test_case)/sizeof(encoded_field_test_case[0]);
i++) {
-    HTTPHdr* headers = new HTTPHdr();
+    ats_scoped_obj<HTTPHdr> headers(new HTTPHdr);
     headers->create(HTTP_TYPE_REQUEST);
 
     http2_parse_header_fragment(headers, make_iovec(encoded_field_test_case[i].encoded_field,
encoded_field_test_case[i].encoded_field_len), header_table);


Mime
View raw message