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

comps: Fix memory issues in group serialization #1743

Merged
merged 1 commit into from
Oct 1, 2024
Merged

Conversation

m-blaha
Copy link
Member

@m-blaha m-blaha commented Oct 1, 2024

This commit addresses two memory issues that occur if saving of the
group XML file fails:

Memory leak: The doc variable is not properly freed before an error is
thrown, leading to a memory leak.

Use after free: The libxml2 error handler continues to reference the
error_to_strings() function, which uses the xml_errors vector that
is local to the Group::serialize() method. If the handler is invoked
later (e.g., during the serialization of an Environment), it may cause a
crash due to accessing freed memory.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2315789

This commit addresses two memory issues that occur if saving of the
group XML file fails:

Memory leak: The `doc` variable is not properly freed before an error is
thrown, leading to a memory leak.

Use after free: The libxml2 error handler continues to reference the
`error_to_strings()` function, which uses the `xml_errors` vector that
is local to the `Group::serialize()` method. If the handler is invoked
later (e.g., during the serialization of an Environment), it may cause a
crash due to accessing freed memory.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2315789
@jrohel
Copy link
Contributor

jrohel commented Oct 1, 2024

Thanks.

@jrohel jrohel added this pull request to the merge queue Oct 1, 2024
Merged via the queue into main with commit 74706c1 Oct 1, 2024
17 of 20 checks passed
@jrohel jrohel deleted the mblaha/xml-serialize branch October 1, 2024 12:06
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