Ticket #1205 (new defect)

Opened 5 years ago

Last modified 4 years ago

[PATCH]: xmlAddChild() frees the node argument sometimes.

Reported by: scriptor Owned by: dgollub
Priority: normal Milestone:
Component: OpenSync: XMLFormat API Version: 0.39
Severity: normal Keywords: xmlAddChild frees its argument from time to time.
Cc:

Description

Hi,

I refer to http://xmlsoft.org/html/libxml-tree.html#xmlAddChild

According to this, the xmlAddChild() function sometimes frees one of its arguments. And I have checked it: Its return value does sometimes differ from the argument the function has been provided with. This has consequences for the code, which I outline in two patches I try to add.

Attachments

opensync_xmlformat.c.diff (728 bytes) - added by scriptor 5 years ago.
opensync_xmlfield.c.diff (627 bytes) - added by scriptor 5 years ago.
opensync_xmlformat.c.2.diff (5.0 KB) - added by scriptor 4 years ago.
New version of opensync_xmlformat.c.diff, as of Feb, 7th 2010.

Change History

Changed 5 years ago by scriptor

Changed 5 years ago by scriptor

comment:1 Changed 4 years ago by scriptor

While these patches solve one memory problem, they create a new memory error. "merging adjacent TEXT nodes" means that one node vanishes. Or in other words: After such a merger, we have two OSyncXMLFields with identical node pointers. Which leeds to a double free memory vioation eventually.

Or with respect to the osync_xmlformat_sort() function: The number of children changes. Which makes the sorting more complicated.

I have tried to change the osync_xmlformat_sort() function accordingly and I attach a patch at least for opensync_xmlformat.c. For opensync_xmlfield.c, I haven't prepared a patch, yet.

Bye, bye.

Changed 4 years ago by scriptor

New version of opensync_xmlformat.c.diff, as of Feb, 7th 2010.

Note: See TracTickets for help on using tickets.