]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: connections: Don't forget to set xprt_ctx to NULL on close.
authorOlivier Houchard <ohouchard@haproxy.com>
Mon, 13 May 2019 17:10:46 +0000 (19:10 +0200)
committerOlivier Houchard <cognet@ci0.org>
Mon, 13 May 2019 17:11:38 +0000 (19:11 +0200)
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.

include/proto/connection.h

index f1919ce717c0f2e50af729bc006c12a6886a1960..8a2884e2dd71581d072fd21ce9c25e7b8af9f26b 100644 (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->xprt->close)
                        conn->xprt->close(conn, conn->xprt_ctx);
+               conn->xprt_ctx = NULL;
                conn->flags &= ~CO_FL_XPRT_READY;
        }
 }