libxml2 r3711 - trunk



Author: veillard
Date: Mon Mar 24 11:12:55 2008
New Revision: 3711
URL: http://svn.gnome.org/viewvc/libxml2?rev=3711&view=rev

Log:
* threads.c: check some allocation with Ashwin patch
Daniel


Modified:
   trunk/ChangeLog
   trunk/threads.c

Modified: trunk/threads.c
==============================================================================
--- trunk/threads.c	(original)
+++ trunk/threads.c	Mon Mar 24 11:12:55 2008
@@ -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);



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