]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: applet: Don't call .release callback function twice
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 15 Mar 2022 10:29:59 +0000 (11:29 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 15 Mar 2022 10:47:53 +0000 (11:47 +0100)
Since the CS/SI refactoring, the .release callback function may be called
twice. The first call when a shutdown for read or for write is performed.
The second one when the applet is detached from its conn-stream. The second
call must be guarded, just like the first one, to only be performed is the
stream-interface is not the in disconnected (SI_ST_DIS) or closed
(SI_ST_CLO) state.

To simplify the fix, we now always rely on si_applet_release() function.

It is 2.6-specific, no backport is needed.

src/conn_stream.c

index df4181c15892048233501a5cecb0aee39b9a4191..86db303612a217c6b5fff803cca979155f465aa5 100644 (file)
@@ -129,8 +129,8 @@ void cs_detach_endp(struct conn_stream *cs)
                }
        }
        else if ((appctx = cs_appctx(cs))) {
-               if (appctx->applet->release)
-                       appctx->applet->release(appctx);
+               if (cs->si)
+                       si_applet_release(cs->si);
                appctx_free(appctx);
        }