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.

(cherry picked from commit 282389a332)
This commit is contained in:
Simon Goldschmidt 2018-12-03 07:14:02 +01:00
parent 89be04ce7a
commit ff14bbb3c1

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); lpcb = altcp_listen_with_backlog_and_err(conn->inner_conn, backlog, err);
if (lpcb != NULL) { 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; conn->inner_conn = lpcb;
altcp_accept(lpcb, altcp_mbedtls_lower_accept); altcp_accept(lpcb, altcp_mbedtls_lower_accept);
return conn; return conn;