]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: server: fix srv_drop() crash on partially init srv
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 25 Nov 2025 14:07:51 +0000 (15:07 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 25 Nov 2025 14:16:13 +0000 (15:16 +0100)
A recent patch has introduced free operation for QUIC tokens stored in a
server. These values are located in <per_thr> server array.

However, a server instance may be released prior to its full
initialization in case of a failure during "add server" CLI command. The
mentionned patch would cause a srv_drop() crash due to an invalid usage
of NULL <per_thr> member.

Fix this by adding a check on <per_thr> prior to dereference it in
srv_drop().

No need to backport.

src/server.c

index f9244921928010818d4c63516dfddd5da2ee75ba..988a83fb08a11794683c997c5b50d95a24d9c7dc 100644 (file)
@@ -3241,8 +3241,10 @@ struct server *srv_drop(struct server *srv)
 
        free(srv->id);
 #ifdef USE_QUIC
-       for (i = 0; i < global.nbthread; i++)
-               istfree(&srv->per_thr[i].quic_retry_token);
+       if (srv->per_thr) {
+               for (i = 0; i < global.nbthread; i++)
+                       istfree(&srv->per_thr[i].quic_retry_token);
+       }
 #endif
        srv_free_params(srv);