rpm-software-management / dnf5

Next-generation RPM package management system
Other
256 stars 86 forks source link

comps: Fix memory issues in group serialization #1743

Closed m-blaha closed 1 month ago

m-blaha commented 1 month ago

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 commented 1 month ago

Thanks.