]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: applet: Immediately free appctx on early error
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 16 Feb 2024 14:00:07 +0000 (15:00 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 16 Feb 2024 14:48:08 +0000 (15:48 +0100)
When an error is triggered during the applet initialization, a dedicated
function is called to release it. Indeed, in this case, because the applet
was not initialized, the ->release callback must not be called. However,
because the init stage may be delayed to be performed during the first
applet wakeup, we must also take care to not rely on the default
appctx_free() function, to immediately release the applet. Otherwise, if the
error happens in a delayed init stage, the applet is never released.

This patch partially fix the issue #2451. It must be backported as far as
2.6.

src/applet.c

index 0525967f5159962e40dd0447aa3b3a24e3d6a1de..303d9f70809f96cff002775113167859d3d7c42e 100644 (file)
@@ -340,7 +340,7 @@ void appctx_free_on_early_error(struct appctx *appctx)
                stream_free(appctx_strm(appctx));
                return;
        }
-       appctx_free(appctx);
+       __appctx_free(appctx);
 }
 
 void appctx_free(struct appctx *appctx)