Skip to content

Commit

Permalink
fix leak in early data
Browse files Browse the repository at this point in the history
  • Loading branch information
duke8253 committed Jun 29, 2020
1 parent 3d14b21 commit 80ad5b5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions iocore/net/SSLUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1828,10 +1828,6 @@ SSLAccept(SSL *ssl)

if (SSLConfigParams::server_max_early_data > 0 && !netvc->early_data_finish) {
size_t nread;
if (netvc->early_data_buf == nullptr) {
netvc->early_data_buf = new_MIOBuffer(BUFFER_SIZE_INDEX_16K);
netvc->early_data_reader = netvc->early_data_buf->alloc_reader();
}

while (true) {
IOBufferBlock *block = new_IOBufferBlock();
Expand All @@ -1840,9 +1836,14 @@ SSLAccept(SSL *ssl)

if (ret == SSL_READ_EARLY_DATA_ERROR) {
Debug("ssl_early_data", "SSL_READ_EARLY_DATA_ERROR");
block->free();
break;
} else {
if (nread > 0) {
if (netvc->early_data_buf == nullptr) {
netvc->early_data_buf = new_MIOBuffer(BUFFER_SIZE_INDEX_16K);
netvc->early_data_reader = netvc->early_data_buf->alloc_reader();
}
block->fill(nread);
netvc->early_data_buf->append_block(block);
SSL_INCREMENT_DYN_STAT(ssl_early_data_received_count);
Expand All @@ -1851,6 +1852,8 @@ SSLAccept(SSL *ssl)
std::string early_data_str(reinterpret_cast<char *>(block->buf()), nread);
Debug("ssl_early_data_show_received", "Early data buffer: \n%s", early_data_str.c_str());
}
} else {
block->free();
}

if (ret == SSL_READ_EARLY_DATA_FINISH) {
Expand Down

0 comments on commit 80ad5b5

Please sign in to comment.