Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
plug some little memleaks
[simgrid.git] / src / xbt / xbt_os_thread.c
index 00e5c55..54880f6 100644 (file)
@@ -103,6 +103,11 @@ void xbt_os_thread_mod_exit(void) {
 
 //   if ((errcode=pthread_key_delete(xbt_self_thread_key)))
 //     THROW0(system_error,errcode,"pthread_key_delete failed for xbt_self_thread_key");
+   free(main_thread->exception);
+   free(main_thread);
+#ifndef HAVE_SEM_WAIT
+   xbt_os_mutex_destroy(next_sem_ID_lock);
+#endif
 }
 
 static void * wrapper_start_routine(void *s) {
@@ -155,6 +160,9 @@ xbt_os_thread_join(xbt_os_thread_t thread,void ** thread_return) {
    if (thread->exception)
      free(thread->exception);
 
+   if (thread->name)
+     free(thread->name);
+   
    if (thread == main_thread) /* just killed main thread */
      main_thread = NULL;