Re: [xml] another of those fun SEGV's in xmlFreeDoc?



On Thu, Oct 27, 2005 at 09:49:39AM -0700, Rick Jones wrote:
Daniel Veillard wrote:
On Thu, Oct 27, 2005 at 09:14:15AM -0700, Rick Jones wrote:

if ((*message = xmlParseMemory(message_base,message_len)) != NULL) {



 Hum, okay , could try to use xmlReadMemory and check if problem persists

What sematic differences are there?  Does xlmReadMemory do validation and 
attribute loading from the DTD (more that I left-out originally, sorry - 
i'm not the only one "contributing" to this code and they went down a path 
of getting default values from a DTD)

  no. It's the new parser API, the one using SAX2 parser and not the old one.

fromnid = xmlGetProp(msg,(const xmlChar *)"fromnid");


 seems fromnid value ain't checked and the returned string is leaked as
not xmlFree'd

IIRC, the messages pass-through validation, so if there isn't a fromnid, I 
_think_ xmlParseMemory will have failed?

  Validation is not a fatal error. You still get a document on a non valid
instance.

  I can't guess what this does to doc or cur.
  Do you still get the problem if you skip that step ?

Yeah, I was wondering about that as I was doing the cut-and-paste.  I'll go 
digging through to see what that routine might be doing...

 yeah, this should not hang

 Did you tried to run your app under valgrind. I can't see anything wrong 
which would lead to the problem

I have no idea what valgrind is, so nope :)

then it's really time you stop anything else and learn about it. Seriously
it spots memory use error, is present in all Linux distros and works by
reinterpreting instructions (so slow but extremely accurate and thorough)

   http://valgrind.org/

it will spot for example the unfreed attribute value.

Daniel

-- 
Daniel Veillard      | Red Hat http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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