altcp_tls: fix pbuf leaked when handshake failed

Signed-off-by: goldsimon <goldsimon@gmx.de>
This commit is contained in:
David Girault 2018-01-16 16:55:55 +01:00 committed by goldsimon
parent 30ddfe1a98
commit c7106cc57f

View File

@ -894,6 +894,11 @@ altcp_mbedtls_close(struct altcp_pcb *conn)
}
state = (altcp_mbedtls_state_t *)conn->state;
if (state != NULL) {
if (state->rx) {
/* free leftover (unhandled) rx pbufs */
pbuf_free(state->rx);
state->rx = NULL;
}
state->flags |= ALTCP_MBEDTLS_FLAGS_TX_CLOSED;
if (state->flags & ALTCP_MBEDTLS_FLAGS_RX_CLOSED) {
altcp_mbedtls_dealloc(conn);