]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MAJOR: connections: Close the connection before freeing it.
authorOlivier Houchard <cognet@ci0.org>
Wed, 19 Dec 2018 22:21:46 +0000 (23:21 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 20 Dec 2018 05:03:14 +0000 (06:03 +0100)
In si_release_endpoint(), if the end point is a connection, because we don't
know which mux to use it, make sure we close the connection before freeing it,
or else, we'd have a fd left for polling, which would point to a now free'd
connection.

This should be backported to 1.9.

include/proto/stream_interface.h

index f4ba6ee89d0a6f1bd7bba1918eeb7ece64c43bb0..cdc2245f68ca0d5306df3a2e9ee428e58d80258c 100644 (file)
@@ -173,8 +173,11 @@ static inline void si_release_endpoint(struct stream_interface *si)
                if (appctx->applet->release && si->state < SI_ST_DIS)
                        appctx->applet->release(appctx);
                appctx_free(appctx); /* we share the connection pool */
-       } else if ((conn = objt_conn(si->end)))
+       } else if ((conn = objt_conn(si->end))) {
+               conn_stop_tracking(conn);
+               conn_full_close(conn);
                conn_free(conn);
+       }
        si_detach_endpoint(si);
 }