Skip to content

[autobackport: sssd-2-9] KRB5: fix mem leak in authenticate_stored_users()#8537

Merged
alexey-tikhonov merged 2 commits into
SSSD:sssd-2-9from
sssd-bot:SSSD-sssd-backport-pr8517-to-sssd-2-9
Mar 20, 2026
Merged

[autobackport: sssd-2-9] KRB5: fix mem leak in authenticate_stored_users()#8537
alexey-tikhonov merged 2 commits into
SSSD:sssd-2-9from
sssd-bot:SSSD-sssd-backport-pr8517-to-sssd-2-9

Conversation

@sssd-bot

Copy link
Copy Markdown
Contributor

This is an automatic backport of PR#8517 KRB5: fix mem leak in authenticate_stored_users() to branch sssd-2-9, created by @alexey-tikhonov.

Caution

@alexey-tikhonov The patches did not apply cleanly. It is necessary to resolve conflicts before merging this pull request. Commits that introduced conflict are marked with CONFLICT!.

You can push changes to this pull request

git remote add sssd-bot [email protected]:sssd-bot/sssd.git
git fetch sssd-bot refs/heads/SSSD-sssd-backport-pr8517-to-sssd-2-9
git checkout SSSD-sssd-backport-pr8517-to-sssd-2-9
git push sssd-bot SSSD-sssd-backport-pr8517-to-sssd-2-9 --force

Original commits
74e7bc6 - KRB5: fix mem leak in authenticate_stored_users()
5b85b64 - UTIL: fix mem leak if get_active_uid() fails

Backported commits

  • a281a0a - KRB5: fix mem leak in authenticate_stored_users()
  • 8b543a4 - CONFLICT! UTIL: fix mem leak if get_active_uid() fails

Conflicting Files Information (check for deleted and re-added files)

  • CONFLICT! UTIL: fix mem leak if get_active_uid() fails
On branch SSSD-sssd-backport-pr8517-to-sssd-2-9
You are currently cherry-picking commit 5b85b647e.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   src/util/find_uid.c

no changes added to commit (use "git add" and/or "git commit -a")

Original Pull Request Body

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request backports two memory leak fixes. The fix in src/providers/krb5/krb5_delayed_online_authentication.c is correct and properly frees a hash table on all exit paths. However, the changes in src/util/find_uid.c introduce a merge conflict that must be resolved. The code in its current state will not compile. I have provided a critical review comment with a suggested resolution for the conflict.

Comment thread src/util/find_uid.c Outdated
@alexey-tikhonov
alexey-tikhonov force-pushed the SSSD-sssd-backport-pr8517-to-sssd-2-9 branch from 8b543a4 to 91735dd Compare March 20, 2026 08:11
@alexey-tikhonov

Copy link
Copy Markdown
Member

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses a couple of memory leaks by ensuring hash_table_t objects are properly destroyed in all code paths. The changes in src/providers/krb5/krb5_delayed_online_authentication.c add cleanup calls in both success and error scenarios. Similarly, the change in src/util/find_uid.c prevents a leak if get_active_uid_linux() fails. While the fixes are correct, I've suggested improvements to check the return value of hash_destroy() to ensure the cleanup is successful and to log any failures, which is crucial for robustness, especially on success paths.

Comment thread src/providers/krb5/krb5_delayed_online_authentication.c
Comment thread src/providers/krb5/krb5_delayed_online_authentication.c
Comment thread src/util/find_uid.c
@alexey-tikhonov
alexey-tikhonov marked this pull request as ready for review March 20, 2026 08:23
@alexey-tikhonov
alexey-tikhonov force-pushed the SSSD-sssd-backport-pr8517-to-sssd-2-9 branch from 91735dd to 90d4ba7 Compare March 20, 2026 10:22
Reviewed-by: Justin Stephenson <[email protected]>
Reviewed-by: Sumit Bose <[email protected]>
(cherry picked from commit 74e7bc6)
Reviewed-by: Justin Stephenson <[email protected]>
Reviewed-by: Sumit Bose <[email protected]>
(cherry picked from commit 5b85b64)
@sssd-bot

Copy link
Copy Markdown
Contributor Author

The pull request was accepted by @alexey-tikhonov with the following PR CI status:


🟢 CodeQL (success)
🟢 rpm-build:centos-stream-9-x86_64:upstream (success)
🟢 Build / make-distcheck (success)
🟢 ci / prepare (success)
🟢 ci / system (centos-9) (success)
🟢 Static code analysis / codeql (success)
🟢 Static code analysis / pre-commit (success)
🟢 Static code analysis / python-system-tests (success)


There are unsuccessful or unfinished checks. Make sure that the failures are not related to this pull request before merging.

@sssd-bot
sssd-bot force-pushed the SSSD-sssd-backport-pr8517-to-sssd-2-9 branch from 90d4ba7 to 000aa50 Compare March 20, 2026 16:33
@alexey-tikhonov
alexey-tikhonov merged commit 7ccc1b7 into SSSD:sssd-2-9 Mar 20, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants