10000 Potential double free · pyromanci/esp32_https_server@9a7d4f2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9a7d4f2

Browse files
authored
Potential double free
1 parent ff0b19e commit 9a7d4f2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/HTTPSConnection.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ HTTPSConnection::HTTPSConnection(ResourceResolver * resResolver):
1313
HTTPSConnection::~HTTPSConnection() {
1414
// Close the socket
1515
closeConnection();
16+
#ifdef HTTPS_USE_MBEDTLS
17+
freeSSL();
18+
}
19+
20+
void HTTPSConnection::freeSSL() {
21+
mbedtls_ssl_free( &_ssl );
22+
mbedtls_net_free( &_client_fd );
23+
#endif
1624
}
1725

1826
bool HTTPSConnection::isSecure() {
@@ -77,7 +85,6 @@ int HTTPSConnection::initialize(mbedtls_net_context * server_fd, mbedtls_ssl_con
7785
}
7886

7987
mbedtls_ssl_session_reset( &_ssl );
80-
mbedtls_net_free( &_client_fd );
8188
}
8289
}
8390
#ifdef MBEDTLS_ERROR_C

0 commit comments

Comments
 (0)
0