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

[xml] Fixes in threads.c



Hi,

       A couple of NULL checks after malloc were missing in threads.c, and another check for pthread_key_create was repeated, patch attached for the same.

Regards

Ashwin

 

 

 

*** threads.c	2008-03-18 11:24:58.000000000 +0530
--- threadsfix.c	2008-03-18 11:29:08.000000000 +0530
*************** __xmlGlobalInitMutexLock(void)
*** 436,441 ****
--- 436,443 ----
      /* Create a new critical section */
      if (global_init_lock == NULL) {
  	cs = malloc(sizeof(CRITICAL_SECTION));
+ 	if (cs == NULL)
+ 	    return;
  	InitializeCriticalSection(cs);
  
  	/* Swap it into the global_init_lock */
*************** xmlGetGlobalState(void)
*** 665,670 ****
--- 667,674 ----
      if (globalval == NULL) {
  	xmlGlobalState *tsd = xmlNewGlobalState();
  	p = (xmlGlobalStateCleanupHelperParams *) malloc(sizeof(xmlGlobalStateCleanupHelperParams));
+ 	if (p == NULL)
+ 	    return NULL;
  	p->memory = tsd;
  #if defined(LIBXML_STATIC) && !defined(LIBXML_STATIC_FOR_DLL)
  	DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), 
*************** xmlInitThreads(void)
*** 829,835 ****
  	    (pthread_cond_init != NULL) &&
  	    (pthread_equal != NULL) &&
  	    (pthread_self != NULL) &&
- 	    (pthread_key_create != NULL) &&
  	    (pthread_cond_signal != NULL)) {
  	    libxml_is_threaded = 1;
  /* fprintf(stderr, "Running multithreaded\n"); */
--- 833,838 ----


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