]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: h3: release resources on close
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 29 Mar 2022 12:46:55 +0000 (14:46 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 30 Mar 2022 14:12:18 +0000 (16:12 +0200)
Implement the release app-ops ops for H3 layer. This is used to clean up
uni-directional streams and the h3 context.

This prevents a memory leak on H3 resources for each connection.

src/h3.c

index 463c1318ada94c9cdcbbd51e5b656707b51c0409..4d373f5d93e88c76d871448443847659f6301ce3 100644 (file)
--- a/src/h3.c
+++ b/src/h3.c
@@ -892,6 +892,15 @@ static int h3_init(struct qcc *qcc)
        return 0;
 }
 
+static void h3_release(void *ctx)
+{
+       struct h3 *h3 = ctx;
+
+       h3_uqs_release_all(h3);
+       h3_uqs_tasklets_release(h3);
+       pool_free(pool_head_h3, h3);
+}
+
 /* HTTP/3 application layer operations */
 const struct qcc_app_ops h3_ops = {
        .init        = h3_init,
@@ -899,4 +908,5 @@ const struct qcc_app_ops h3_ops = {
        .decode_qcs  = h3_decode_qcs,
        .snd_buf     = h3_snd_buf,
        .finalize    = h3_finalize,
+       .release     = h3_release,
 };