[xml] xmlAddChild question



The description of xmlAddChild says:

 

“Add a new node to @parent, at the end of the child (or property) list merging adjacent TEXT nodes (in which case @cur is freed).”

 

and the description of xmlAddChildList says:

 

“Add a list of node at the end of the child list of the parent merging adjacent TEXT nodes (@cur may be freed)”

 

Assuming that @cur is freed in the case of “merging adjacent text nodes” (as the sentence seems to read and bolstered by the “may” in the second description above), how is one to know whether adjacent TEXT nodes were merged in order to know whether @cur is freed? 

 

We had a case of a memory leak because we generally assumed @cur was freed, but when we added an empty value text node, it was not.  We don’t generally have “adjacent TEXT nodes”, so it seems that “merging adjacent TEXT nodes” is not a qualification of whether @cur is freed, which would mean no information is necessary on the status of node merges.  Our experience is that the @cur is freed if the function succeeds, except in the case of adding an empty text node (even though the add child function succeeds in this case).  Can you clarify when @cur is freed or not freed?

 

 

Bruce Sinclair

Software Systems Developer Senior Principal

 

Micro Focus

 

bruce sinclair microfocus com

8310 N. Capital of Texas Hwy.

Building Two, Suite 100
Austin, Texas  78731-1002
Direct: +1 512 340 4717

 

This message has been scanned by MailController.

 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]