gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r13981 - libmicrohttpd/src/daemon


From: gnunet
Subject: [GNUnet-SVN] r13981 - libmicrohttpd/src/daemon
Date: Tue, 21 Dec 2010 15:18:48 +0100

Author: grothoff
Date: 2010-12-21 15:18:48 +0100 (Tue, 21 Dec 2010)
New Revision: 13981

Modified:
   libmicrohttpd/src/daemon/daemon.c
Log:
leaks

Modified: libmicrohttpd/src/daemon/daemon.c
===================================================================
--- libmicrohttpd/src/daemon/daemon.c   2010-12-21 14:11:07 UTC (rev 13980)
+++ libmicrohttpd/src/daemon/daemon.c   2010-12-21 14:18:48 UTC (rev 13981)
@@ -773,15 +773,12 @@
   
   if (daemon->thread_stack_size != 0) 
     {
-      if ( (0 != (ret = pthread_attr_init (&attr))) ||
-          (0 != (ret = pthread_attr_setstacksize (&attr, 
daemon->thread_stack_size))) )
+      if (0 != (ret = pthread_attr_init (&attr))) 
+       goto ERR;
+      if (0 != (ret = pthread_attr_setstacksize (&attr, 
daemon->thread_stack_size)))
        {
-#if HAVE_MESSAGES
-         MHD_DLOG (daemon,
-                   "Failed to set thread stack size\n");
-#endif
-         errno = EINVAL;
-         return ret;
+         pthread_attr_destroy (&attr);
+         goto ERR;
        }
       pattr = &attr;
     }
@@ -791,9 +788,16 @@
     }
   ret = pthread_create (thread, pattr,
                        start_routine, arg);
-  if (pattr != NULL)
+  if (daemon->thread_stack_size != 0) 
     pthread_attr_destroy (&attr);
   return ret;
+ ERR:
+#if HAVE_MESSAGES
+  MHD_DLOG (daemon,
+           "Failed to set thread stack size\n");
+#endif
+  errno = EINVAL;
+  return ret;
 }
 
 
@@ -1760,6 +1764,8 @@
       MHD_DLOG (retVal,
                "MHD poll support only works with 
MHD_USE_THREAD_PER_CONNECTION\n");
 #endif
+      free (retVal->nnc);
+      pthread_mutex_destroy (&retVal->nnc_lock);
       free (retVal);
       return NULL;
     }
@@ -1945,6 +1951,10 @@
                "Failed to initialize TLS support\n");
 #endif
       CLOSE (socket_fd);
+#ifdef DAUTH_SUPPORT
+      pthread_mutex_destroy (&retVal->nnc_lock);
+      free (retVal->nnc);
+#endif
       pthread_mutex_destroy (&retVal->per_ip_connection_mutex);
       free (retVal);
       return NULL;
@@ -1961,6 +1971,10 @@
                 "Failed to create listen thread: %s\n", 
                STRERROR (res_thread_create));
 #endif
+#ifdef DAUTH_SUPPORT
+      pthread_mutex_destroy (&retVal->nnc_lock);
+      free (retVal->nnc);
+#endif
       pthread_mutex_destroy (&retVal->per_ip_connection_mutex);
       free (retVal);
       CLOSE (socket_fd);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]