[xml] Possible Memory leak in xmlCleanupParser



Hi,

     I have doubt regarding the xmlCleanupParser. Suppose the function is invoked by a thread other than the main thread. Then the function xmlResetLastError will call __xmlLastError, which will call xmlInitializeGlobalState, inside which xmlInitGlobals will allocate memory for xmlThrDefMutex….The memory allocated for this xmlThrDefMutex will leak, because the call to xmlCleanupGlobals happens before the call to xmlResetLastError.

 

 

A possible way to resolve this is to interchange the calls to xmlCleanupGlobals & xmlResetLastError in the function xmlCleanupParser…

 

Previously:

xmlCleanupGlobals();

xmlResetLastError();

 

Changed:

xmlResetLastError();

xmlCleanupGlobals();

 

 

Thanks & Regards

Ashwin

 

 

 

 



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