Skip to content
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

Fix resource leak in unit test "libdnf5-cli/output/test_repoquery.cpp", optimization #1987

Merged
merged 2 commits into from
Jan 7, 2025

Conversation

jrohel
Copy link
Contributor

@jrohel jrohel commented Jan 6, 2025

I discovered a resource leak while working on #1893.
There was a missing "fclose()" in "libdnf5-cli/output/test_repoquery.cpp".

I wrapped open_memstream in "libdnf5-cli/output/test_repoquery.cpp" in the MemStream class to ensure automatic resource release in the destructor. I also made an optimization - replacing std::string with std::string_view with the len argument in the constructor.

@jrohel jrohel changed the title Fixed resource leak in unit test "libdnf5-cli/output/test_repoquery.cpp", optimization Fix resource leak in unit test "libdnf5-cli/output/test_repoquery.cpp", optimization Jan 6, 2025
@ppisar ppisar self-assigned this Jan 7, 2025
Copy link
Contributor

@ppisar ppisar left a comment

Choose a reason for hiding this comment

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

Good.

@ppisar ppisar added this pull request to the merge queue Jan 7, 2025
Merged via the queue into rpm-software-management:main with commit 0903c76 Jan 7, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants