Skip to content

Commit 3fa00be

Browse files
federicomenaquinteroMarge Bot
authored andcommitted
Comment about xmlFreeNode() vs. xmlFreeEntity()
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/985>
1 parent c1a48a8 commit 3fa00be

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

rsvg/src/xml/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,13 @@ struct XmlEntity(xmlEntityPtr);
8686
impl Drop for XmlEntity {
8787
fn drop(&mut self) {
8888
unsafe {
89+
// Even though we are freeing an xmlEntityPtr, historically the code has always
90+
// used xmlFreeNode() because that function actually does allow freeing entities.
91+
//
92+
// See https://gitlab.gnome.org/GNOME/libxml2/-/issues/731
93+
// for a possible memory leak on older versions of libxml2 when using
94+
// xmlFreeNode() instead of xmlFreeEntity() - the latter just became public
95+
// in librsvg-2.12.0.
8996
xmlFreeNode(self.0);
9097
}
9198
}

0 commit comments

Comments
 (0)