BUG/MINOR: jwt: Double free in deinit function
authorRemi Tricot-Le Breton <rlebreton@haproxy.com>
Fri, 4 Feb 2022 13:06:34 +0000 (14:06 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Feb 2022 13:40:46 +0000 (14:40 +0100)
The node pointer was not moving properly along the jwt_cert_tree during
the deinit which ended in a double free during cleanup (or when checking
a configuration that used the jwt_verify converter with an explicit
certificate specified).

This patch fixes GitHub issue #1533.
It should be backported to 2.5.

(cherry picked from commit 4930c6c869fb875554d60ce9a2d6362cf16cf295)
Signed-off-by: Willy Tarreau <w@1wt.eu>

src/jwt.c

index 8c45375..1c13209 100644 (file)
--- a/src/jwt.c
+++ b/src/jwt.c
@@ -363,6 +363,7 @@ static void jwt_deinit(void)
        node = ebmb_first(&jwt_cert_tree);
        while (node) {
                entry = ebmb_entry(node, struct jwt_cert_tree_entry, node);
+               ebmb_delete(node);
                ha_free(&entry);
                node = ebmb_first(&jwt_cert_tree);
        }