summaryrefslogtreecommitdiff
path: root/threads.c
diff options
context:
space:
mode:
Diffstat (limited to 'threads.c')
-rw-r--r--threads.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/threads.c b/threads.c
index b4a4cdc..d7bd783 100644
--- a/threads.c
+++ b/threads.c
@@ -359,6 +359,9 @@ xmlRMutexUnlock(xmlRMutexPtr tok ATTRIBUTE_UNUSED)
************************************************************************/
#ifdef LIBXML_THREAD_ENABLED
+#ifdef xmlLastError
+#undef xmlLastError
+#endif
/**
* xmlFreeGlobalState:
* @state: a thread global state
@@ -369,8 +372,10 @@ xmlRMutexUnlock(xmlRMutexPtr tok ATTRIBUTE_UNUSED)
static void
xmlFreeGlobalState(void *state)
{
- /* free any memory allocated in the thread's xmlLastError */
- xmlResetLastError();
+ xmlGlobalState *gs = (xmlGlobalState *) state;
+
+ /* free any memory allocated in the thread's xmlLastError */
+ xmlResetError(&(gs->xmlLastError));
free(state);
}