]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: uri-auth: fix possible null-deref in latest fix for leaks
authorWilly Tarreau <w@1wt.eu>
Mon, 11 May 2026 14:33:00 +0000 (16:33 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 11 May 2026 14:33:44 +0000 (16:33 +0200)
Latest commit 2dfbc311a8 ("BUG/MINOR: uri-auth: avoid leaks on
initialization error") left a possible null-deref case which was
surprisingly only detected by certain compiler combinations. No
backport needed.

src/uri_auth.c

index 9de6fbbc670ea2c2a6fef85a6f29d6e38d7e2017..db1d83dc5bd404377690c4f015dadd3e4e34fa83 100644 (file)
@@ -269,7 +269,7 @@ struct uri_auth *stats_add_auth(struct uri_auth **root, char *user)
                free(newuser->user);
                free(newuser);
        }
-       if (!old_u) {
+       if (u && !old_u) {
                if (u->userlist) {
                        free(u->userlist->name);
                        free(u->userlist);