prevent linking a freed GThread structure into global thread list in error
authorTim Janik <timj@imendio.com>
Mon, 13 Aug 2007 12:18:55 +0000 (12:18 +0000)
committerTim Janik <timj@src.gnome.org>
Mon, 13 Aug 2007 12:18:55 +0000 (12:18 +0000)
Mon Aug 13 14:18:22 2007  Tim Janik  <timj@imendio.com>

       * glib/gthread.c (g_thread_create_full): prevent linking a freed
       GThread structure into global thread list in error cases.

svn path=/trunk/; revision=5697

ChangeLog
glib/gthread.c

index fa10f19..67a5c42 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Aug 13 14:18:22 2007  Tim Janik  <timj@imendio.com>
+
+       * glib/gthread.c (g_thread_create_full): prevent linking a freed
+       GThread structure into global thread list in error cases.
+
 2007-08-08  Matthias Clasen  <mclasen@redhat.com>
 
        * glib/gmarkup.c (append_escaped_text): Handle restricted
index fe9f25d..5468e59 100644 (file)
@@ -579,7 +579,7 @@ g_thread_cleanup (gpointer data)
 
          /* Just to make sure, this isn't used any more */
          g_system_thread_assign (thread->system_thread, zero_thread);
-         g_free (thread);
+          g_free (thread);
        }
     }
 }
@@ -662,8 +662,11 @@ g_thread_create_full (GThreadFunc           func,
   G_THREAD_UF (thread_create, (g_thread_create_proxy, result,
                               stack_size, joinable, bound, priority,
                               &result->system_thread, &local_error));
-  result->next = g_thread_all_threads;
-  g_thread_all_threads = result;
+  if (!local_error)
+    {
+      result->next = g_thread_all_threads;
+      g_thread_all_threads = result;
+    }
   G_UNLOCK (g_thread);
 
   if (local_error)