Re: [xml] Memory Leak



Today at 16:32, crazzeto comcast net wrote:

I managed to take care of this problem actually. I didn't realize it right off but apparently the 
xmlCharStrdup function does a malloc() when I really didn't belive it needed to. So in my code I had

if( cur->name == xmlCharStrdup( "response_code" ) ) {
           /*  Do Work */
}

Not claiming that I know libxml2 interfaces very well, but did this
condition ever get to "Do Work"? I'd guess that xmlCharStrdup returned
a pointer to whatever libxml2 considers a string "response_code", and 
that's very unlikely to be the same pointer as the one in cur->name.

I'd think some equivalent of strcmp is necessary here.

Cheers,
Danilo



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