Re: [xml] Need help: My program trying to free



I've seen a similar problem but it is based on incorrect usage of the way the xmlTextReader is allocated.

If you allocate your text reader with xmlNewTextReaderFilename and don't call xmlTextReaderSetup then we you call xmlFreeTextReader you'll get a core dump when it tries to dereference one of the fields inside the xmlTextReader structure. The correct way to create the xmlTextReader is to use xmlReaderForFile.

Reid.

On Sun, 2004-03-28 at 03:17, Daniel Veillard wrote:
On Sat, Mar 27, 2004 at 09:16:13PM -0500, Jones, Mark A (Mark) wrote:
> I'm getting a core dump after calling xmlFreeTextReader(reader).  Has anyone seen a problem like this before?  I show the piece of code that is dropping the core along with a few stack frames (gdb) from the core file.   Any insight would be much appreciated.
[..]
>         type = processNode(reader);                                                                       
>         if ( type == DETAILS || type == DETAIL )       
>             ret = xmlTextReaderNext(reader);           
>         else                                           
>             ret = xmlTextReaderRead(reader);           
>     }                                                          
>     xmlFreeTextReader(reader);                         

  Without a way to reproduce the problem, I don't see what might be going
wrong. maybe processNode() made a free error, maybe your program made a free
error, destroying the allocator data and making xmlFreeTextReader() fail.
Use valgrind or other memory debugging tool.

Daniel

Attachment: signature.asc
Description: This is a digitally signed message part



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