altcp_tls_mbedtls: listen: free members of the ssl context

The ssl context is not used on listening pcbs. This includes freeing
input/output buffers, so saves ~32KByte by default.
This commit is contained in:
Simon Goldschmidt 2018-12-03 07:14:02 +01:00
parent 930eb27ba7
commit 282389a332

View File

@ -985,6 +985,11 @@ altcp_mbedtls_listen(struct altcp_pcb *conn, u8_t backlog, err_t *err)
}
lpcb = altcp_listen_with_backlog_and_err(conn->inner_conn, backlog, err);
if (lpcb != NULL) {
altcp_mbedtls_state_t *state = (altcp_mbedtls_state_t *)conn->state;
/* Free members of the ssl context (not used on listening pcb). This
includes freeing input/output buffers, so saves ~32KByte by default */
mbedtls_ssl_free(&state->ssl_context);
conn->inner_conn = lpcb;
altcp_accept(lpcb, altcp_mbedtls_lower_accept);
return conn;