summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faulet <cfaulet@haproxy.com>2023-05-15 09:53:29 +0200
committerChristopher Faulet <cfaulet@haproxy.com>2023-05-15 09:53:30 +0200
commit6eb53b138d9f190b0fa3ae4abfc292a9c7ca7cdd (patch)
tree20937513124a7e11caacca5c813c952d02f9d1a6
parent1601eebcd1dfe47e3222531c91db196e836f562e (diff)
downloadhaproxy-6eb53b138d9f190b0fa3ae4abfc292a9c7ca7cdd.tar.gz
MINOR: stconn: Remove useless test on sedesc on detach to release the xref
When the SC is detached from the endpoint, the xref between the endpoints is removed. At this stage, the sedesc cannot be undefined. So we can remove the test on it. This issue should fix the issue #2156. No backport needed.
-rw-r--r--src/stconn.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/stconn.c b/src/stconn.c
index 2339566d7..3d80b2c19 100644
--- a/src/stconn.c
+++ b/src/stconn.c
@@ -351,18 +351,16 @@ int sc_attach_strm(struct stconn *sc, struct stream *strm)
static void sc_detach_endp(struct stconn **scp)
{
struct stconn *sc = *scp;
+ struct xref *peer;
if (!sc)
return;
- if (sc->sedesc) {
- struct xref *peer;
- /* Remove my link in the original objects. */
- peer = xref_get_peer_and_lock(&sc->sedesc->xref);
- if (peer)
- xref_disconnect(&sc->sedesc->xref, peer);
- }
+ /* Remove my link in the original objects. */
+ peer = xref_get_peer_and_lock(&sc->sedesc->xref);
+ if (peer)
+ xref_disconnect(&sc->sedesc->xref, peer);
if (sc_ep_test(sc, SE_FL_T_MUX)) {
struct connection *conn = __sc_conn(sc);