check some allocation with Ashwin patch Daniel
* threads.c: check some allocation with Ashwin patch
Daniel
svn path=/trunk/; revision=3711
diff --git a/ChangeLog b/ChangeLog
index 480cfec..3f8fa4c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Mon Mar 24 12:12:00 CET 2008 Daniel Veillard <daniel@veillard.com>
+
+ * threads.c: check some allocation with Ashwin patch
+
Wed Mar 19 16:41:52 CET 2008 Daniel Veillard <daniel@veillard.com>
* vms/build_libxml.com: update from Tycho Hilhorst, should fix #523378
diff --git a/threads.c b/threads.c
index 97ea5d4..6481b40 100644
--- a/threads.c
+++ b/threads.c
@@ -504,7 +504,9 @@
#ifdef HAVE_PTHREAD_H
pthread_mutex_unlock(&global_init_lock);
#elif defined HAVE_WIN32_THREADS
- LeaveCriticalSection(global_init_lock);
+ if (global_init_lock != NULL) {
+ LeaveCriticalSection(global_init_lock);
+ }
#elif defined HAVE_BEOS_THREADS
release_sem(global_init_lock);
#endif
@@ -657,6 +659,8 @@
if ((globalval = (xmlGlobalState *)
pthread_getspecific(globalkey)) == NULL) {
xmlGlobalState *tsd = xmlNewGlobalState();
+ if (tsd == NULL)
+ return(NULL);
pthread_setspecific(globalkey, tsd);
return (tsd);
@@ -720,9 +724,10 @@
xmlOnceInit();
- if ((globalval = (xmlGlobalState *)
- tls_get(globalkey)) == NULL) {
+ if ((globalval = (xmlGlobalState *) tls_get(globalkey)) == NULL) {
xmlGlobalState *tsd = xmlNewGlobalState();
+ if (tsd == NULL)
+ return (NULL);
tls_set(globalkey, tsd);
on_exit_thread(xmlGlobalStateCleanup, NULL);