[xml] Global error (xmlLastError) not cleaned up if xmlCleanupParser() is called on a different thread!

2014-04-10 Thread Martin Ba
Hi all! It would appear that when you have a scenario like this + + + + // Thread 1: xmlInitParser(); // ... // anything that sets the last error, e.g.: xmlReadFile(file isn't there, NULL, XML_PARSE_NOBLANKS); // Thread 2: xmlCleanupParser(); + + + + even if (in Thread_2) you correctly

[xml] [PATCH] fix memory leak xml header encoding field in combination with XML_PARSE_IGNORE_ENC

2014-04-10 Thread Bart De Schuymer
Hello, When the xml parser encounters an xml encoding in an xml header while configured with option XML_PARSE_IGNORE_ENC, it fails to free memory allocated for storing the encoding. The patch below fixes this. How to reproduce: 1. Change doc/examples/parse4.c to add xmlCtxtUseOptions(ctxt,

Re: [xml] memory leak: attribute values are not freed when exception is thrown in the startElement callback

2014-04-10 Thread Nikolay Sivov
On 4/10/2014 16:20, Bart De Schuymer wrote: Hello, We tried using libxml2 configured with the --with-fexceptions option and have identified a memory leak when our C++ startElement callback throws an exception. The cause of the leak is as follows: xmlParseStartTag frees all attribute values

Re: [xml] memory leak: attribute values are not freed when exception is thrown in the startElement callback

2014-04-10 Thread Sam Varshavchik
Nikolay Sivov writes: On 4/10/2014 16:20, Bart De Schuymer wrote: Hello, We tried using libxml2 configured with the --with-fexceptions option and have identified a memory leak when our C++ startElement callback throws an exception. The cause of the leak is as follows: xmlParseStartTag

Re: [xml] memory leak: attribute values are not freed when exception is thrown in the startElement callback

2014-04-10 Thread Bart De Schuymer
On Thu, Apr 10, 2014 at 2:30 PM, Nikolay Sivov bungleh...@gmail.com wrote: On 4/10/2014 16:20, Bart De Schuymer wrote: Hello, We tried using libxml2 configured with the --with-fexceptions option and have identified a memory leak when our C++ startElement callback throws an exception.

Re: [xml] memory leak: attribute values are not freed when exception is thrown in the startElement callback

2014-04-10 Thread Nikolay Sivov
On 4/10/2014 16:53, Bart De Schuymer wrote: On Thu, Apr 10, 2014 at 2:30 PM, Nikolay Sivov bungleh...@gmail.com mailto:bungleh...@gmail.com wrote: On 4/10/2014 16:20, Bart De Schuymer wrote: Hello, We tried using libxml2 configured with the --with-fexceptions option and

Re: [xml] memory leak: attribute values are not freed when exception is thrown in the startElement callback

2014-04-10 Thread Nikolay Sivov
On 4/10/2014 16:53, Bart De Schuymer wrote: On Thu, Apr 10, 2014 at 2:30 PM, Nikolay Sivov bungleh...@gmail.com mailto:bungleh...@gmail.com wrote: On 4/10/2014 16:20, Bart De Schuymer wrote: Hello, We tried using libxml2 configured with the --with-fexceptions option and