]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: quic/server: free quic_retry_token on srv drop
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 24 Nov 2025 13:25:14 +0000 (14:25 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 25 Nov 2025 13:30:18 +0000 (14:30 +0100)
A recent patch has implemented caching of QUIC token received from a
NEW_TOKEN frame into the server cache. This value is stored per thread
into a <quic_retry_token> field.

This field is an ist, first set to an empty string. Via
qc_try_store_new_token(), it is reallocated to fit the size of the newly
stored token. Prior to this patch, the field was never freed so this
causes a memory leak.

Fix this by using istfree() on <quic_retry_token> field during
srv_drop().

No need to backport.

src/server.c

index 1b306148713c0762fb098ae938476987bdea9cce..f9244921928010818d4c63516dfddd5da2ee75ba 100644 (file)
@@ -3211,6 +3211,7 @@ void srv_free_params(struct server *srv)
 struct server *srv_drop(struct server *srv)
 {
        struct server *next = NULL;
+       int i __maybe_unused;
 
        if (!srv)
                goto end;
@@ -3239,6 +3240,10 @@ struct server *srv_drop(struct server *srv)
        task_destroy(srv->srvrq_check);
 
        free(srv->id);
+#ifdef USE_QUIC
+       for (i = 0; i < global.nbthread; i++)
+               istfree(&srv->per_thr[i].quic_retry_token);
+#endif
        srv_free_params(srv);
 
        HA_SPIN_DESTROY(&srv->lock);