Ticket #1205 (new defect)
[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
Change History
comment:1 Changed 3 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 3 years ago by scriptor
- Attachment opensync_xmlformat.c.2.diff added
New version of opensync_xmlformat.c.diff, as of Feb, 7th 2010.
