[xml] A leak in XmlTextReader?



Hello,

The use of xmlNewTextReaderFilename might create a memory leak, because
no one expects that xmlGetCharEncodingHandler() is called
(enc==XML_CHAR_ENCODING_NONE!). So nobody calls
xmlCleanupCharEncoding().

There are two possibilities to solve this problem:
Best version: I would divide the switch-Statement in
xmlGetCharEncodingHandler() (encoding.c) in two parts. The first part
has all the NULL-returns, the second has the rest.
Between both is the xmlInitCharEncodingHandlers()-call.

Second version: The last statement in xmlFreeTextReader should be
xmlCleanupCharEncoding().

Greetings
Michael






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