From: Olivier Houchard Date: Mon, 13 May 2019 17:10:46 +0000 (+0200) Subject: BUG/MEDIUM: connections: Don't forget to set xprt_ctx to NULL on close. X-Git-Tag: v2.0-dev3~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=478281f55d46e85650e218893c78ce1d0ede13b3;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/include/proto/connection.h b/include/proto/connection.h index f1919ce717..8a2884e2dd 100644 --- a/include/proto/connection.h +++ b/include/proto/connection.h @@ -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->xprt->close) conn->xprt->close(conn, conn->xprt_ctx); + conn->xprt_ctx = NULL; conn->flags &= ~CO_FL_XPRT_READY; } }