BUG/MEDIUM: connections: Don't forget to set xprt_ctx to NULL on close.

In conn_xprt_close(), after calling xprt->close(), don't forget to set
conn->xprt_ctx to NULL, or we may attempt to reuse the now-free'd
conn->xprt_ctx if the connection failed and we're retrying it.
This commit is contained in:
Olivier Houchard 2019-05-13 19:10:46 +02:00 committed by Olivier Houchard
parent 4d7bfa1cd1
commit 478281f55d
1 changed files with 1 additions and 0 deletions

View File

@ -99,6 +99,7 @@ static inline void conn_xprt_close(struct connection *conn)
if ((conn->flags & (CO_FL_XPRT_READY|CO_FL_XPRT_TRACKED)) == CO_FL_XPRT_READY) { if ((conn->flags & (CO_FL_XPRT_READY|CO_FL_XPRT_TRACKED)) == CO_FL_XPRT_READY) {
if (conn->xprt->close) if (conn->xprt->close)
conn->xprt->close(conn, conn->xprt_ctx); conn->xprt->close(conn, conn->xprt_ctx);
conn->xprt_ctx = NULL;
conn->flags &= ~CO_FL_XPRT_READY; conn->flags &= ~CO_FL_XPRT_READY;
} }
} }