-
Notifications
You must be signed in to change notification settings - Fork 381
krun: do not leak handles on error #1932
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Reviewer's GuideAdjusts krun context creation and teardown logic to ensure dynamic library handles are correctly closed both on error paths in libkrun_load and during normal unloading in libkrun_unload, preventing handle leaks. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes - here's some feedback:
- The
libkrun_loaderror path now mirrors parts oflibkrun_unload; consider factoring the common handle cleanup (dlclose/free) into a shared helper to avoid duplication and keep the unload behavior consistent across normal and error paths. - In
libkrun_unload, the threedlcloseblocks are nearly identical aside from the handle and error message; consolidating them (e.g., via a small helper or macro) would reduce repetition and make it easier to keep error handling for all handles in sync.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `libkrun_load` error path now mirrors parts of `libkrun_unload`; consider factoring the common handle cleanup (`dlclose`/`free`) into a shared helper to avoid duplication and keep the unload behavior consistent across normal and error paths.
- In `libkrun_unload`, the three `dlclose` blocks are nearly identical aside from the handle and error message; consolidating them (e.g., via a small helper or macro) would reduce repetition and make it easier to keep error handling for all handles in sync.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
TMT tests failed. @containers/packit-build please check. |
flouthoc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
@slp PTAL |
|
LGTM, thanks! |
Summary by Sourcery
Ensure libkrun contexts and associated handles are properly cleaned up on errors and unload.
Bug Fixes: