You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ma...@apache.org on 2018/08/27 01:06:17 UTC
[trafficserver] branch quic-latest updated: QUIC: fix memleaking in
test_QUICFrame
This is an automated email from the ASF dual-hosted git repository.
masaori pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/quic-latest by this push:
new 9e7e83f QUIC: fix memleaking in test_QUICFrame
9e7e83f is described below
commit 9e7e83fbd9c1456e780042113aeb5f85c001d0e6
Author: scw00 <sc...@apache.org>
AuthorDate: Thu Aug 23 15:16:54 2018 +0800
QUIC: fix memleaking in test_QUICFrame
---
iocore/net/quic/QUICPacketReceiveQueue.cc | 2 +-
iocore/net/quic/test/test_QUICFrame.cc | 10 ++++++++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/iocore/net/quic/QUICPacketReceiveQueue.cc b/iocore/net/quic/QUICPacketReceiveQueue.cc
index 9b0a837..309e3b3 100644
--- a/iocore/net/quic/QUICPacketReceiveQueue.cc
+++ b/iocore/net/quic/QUICPacketReceiveQueue.cc
@@ -162,7 +162,7 @@ QUICPacketReceiveQueue::dequeue(QUICPacketCreationResult &result)
this->_payload = nullptr;
this->_payload_len = 0;
this->_offset = 0;
- result = QUICPacketCreationResult::NOT_READY;
+ result = QUICPacketCreationResult::NOT_READY;
return quic_packet;
}
pkt = std::move(this->_payload);
diff --git a/iocore/net/quic/test/test_QUICFrame.cc b/iocore/net/quic/test/test_QUICFrame.cc
index 1a8843a..711d30f 100644
--- a/iocore/net/quic/test/test_QUICFrame.cc
+++ b/iocore/net/quic/test/test_QUICFrame.cc
@@ -325,7 +325,6 @@ TEST_CASE("Store STREAM Frame", "[quic]")
SECTION("split stream frame")
{
- size_t len;
uint8_t buf1[] = {
0x16, // 0b00010OLF (OLF=110)
0x01, // Stream ID
@@ -352,6 +351,8 @@ TEST_CASE("Store STREAM Frame", "[quic]")
CHECK(memcmp(stream_frame2->data(), "\x11\x22\x33\x44\x55", stream_frame2->data_length()) == 0);
CHECK(stream_frame2->offset() == 0x100000000 + 5);
CHECK(stream_frame2->stream_id() == 0x01);
+
+ QUICFrameDeleter::delete_stream_frame(stream_frame2);
}
}
@@ -1251,7 +1252,9 @@ TEST_CASE("QUICFrameFactory Create CONNECTION_CLOSE with a QUICConnectionError",
TEST_CASE("QUICFrameFactory Create RST_STREAM with a QUICStreamError", "[quic]")
{
- QUICStream stream(new MockQUICRTTProvider(), new MockQUICConnection(), 0x1234, 0, 0);
+ MockQUICRTTProvider mock_rtt;
+ MockQUICConnection mock_connection;
+ QUICStream stream(&mock_rtt, &mock_connection, 0x1234, 0, 0);
std::unique_ptr<QUICStreamError> error =
std::unique_ptr<QUICStreamError>(new QUICStreamError(&stream, static_cast<QUICAppErrorCode>(0x01)));
std::unique_ptr<QUICRstStreamFrame, QUICFrameDeleterFunc> rst_stream_frame1 =
@@ -1303,10 +1306,13 @@ TEST_CASE("Retransmit", "[quic][frame][retransmit]")
auto frame = QUICFrameFactory::create_retransmission_frame(std::move(frame1), *packet);
auto frame2 = frame->split(16);
+ CHECK(frame2->type() == QUICFrameType::STREAM);
CHECK(frame2->store(buffer, &len, 128));
CHECK(memcmp(buffer, expected, sizeof(expected)) == 0);
CHECK(frame->store(buffer, &len, 128));
CHECK(memcmp(buffer, expected2, sizeof(expected2)) == 0);
+
+ QUICFrameDeleter::delete_stream_frame(frame2);
}
SECTION("STREAM frame")