summaryrefslogtreecommitdiff
path: root/threads.c
diff options
context:
space:
mode:
authorMike Hommey <glandium@debian.org>2009-03-01 10:55:27 +0100
committerMike Hommey <glandium@debian.org>2009-03-01 10:55:27 +0100
commite248b20a3b7df364cc9617b8685b4c190338bcd2 (patch)
treef289c8584c4a44dd9cdb87003b193488da8b00f3 /threads.c
parent0c8f97ec9edb09da2e0b19c4f9ddf8c725cebc59 (diff)
downloadlibxml2-upstream/2.7.3.dfsg.tar.gz
Import upstream version 2.7.3upstream/2.7.3.dfsg
Diffstat (limited to 'threads.c')
-rw-r--r--threads.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/threads.c b/threads.c
index 23cb200..2223e8a 100644
--- a/threads.c
+++ b/threads.c
@@ -63,6 +63,8 @@ extern int pthread_setspecific (pthread_key_t __key,
extern int pthread_key_create (pthread_key_t *__key,
void (*__destr_function) (void *))
__attribute((weak));
+extern int pthread_key_delete (pthread_key_t __key)
+ __attribute((weak));
extern int pthread_mutex_init ()
__attribute((weak));
extern int pthread_mutex_destroy ()
@@ -83,6 +85,8 @@ extern pthread_t pthread_self ()
__attribute((weak));
extern int pthread_key_create ()
__attribute((weak));
+extern int pthread_key_delete ()
+ __attribute((weak));
extern int pthread_cond_signal ()
__attribute((weak));
#endif
@@ -698,6 +702,7 @@ xmlGetGlobalState(void)
if (p == NULL) {
xmlGenericError(xmlGenericErrorContext,
"xmlGetGlobalState: out of memory\n");
+ xmlFreeGlobalState(tsd);
return(NULL);
}
p->memory = tsd;
@@ -859,6 +864,7 @@ xmlInitThreads(void)
(pthread_getspecific != NULL) &&
(pthread_setspecific != NULL) &&
(pthread_key_create != NULL) &&
+ (pthread_key_delete != NULL) &&
(pthread_mutex_init != NULL) &&
(pthread_mutex_destroy != NULL) &&
(pthread_mutex_lock != NULL) &&
@@ -912,6 +918,9 @@ xmlCleanupThreads(void)
globalkey = TLS_OUT_OF_INDEXES;
}
DeleteCriticalSection(&cleanup_helpers_cs);
+#elif defined HAVE_PTHREAD_H
+ if ((libxml_is_threaded) && (pthread_key_delete != NULL))
+ pthread_key_delete(globalkey);
#endif
}