]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: auth: free user groups on error paths in userlist_postinit()
authorWilly Tarreau <w@1wt.eu>
Mon, 11 May 2026 13:06:41 +0000 (15:06 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 11 May 2026 14:04:19 +0000 (16:04 +0200)
commitfdfecc55899e801558c9cad00761608a03497278
tree98c9275fbd2b9b93ad8f3f783add876f400f4b00
parent0995c914bd6406264e24b44278bbc806c43ba67c
BUG/MINOR: auth: free user groups on error paths in userlist_postinit()

In userlist_postinit(), when an error occurs (missing group, missing user, or
allocation failure), the function returned immediately without freeing the
auth_groups_list linked lists that were built for all users in the first loop.
Each user's curuser->u.groups pointed to these allocated nodes, which leaked
on every error path.

Fix by replacing direct returns with a goto to a centralized cleanup label
that frees all users' groups lists before returning the error. Also fix a
trailing double space in one error return statement while refactoring.

Note that the impact is very low since we're supposed to fail to boo after
such errors.
src/auth.c