thread creation: Simplify error handling
[platform/upstream/glib.git] / glib / gthread-win32.c
index e380b84..2babc92 100644 (file)
@@ -518,7 +518,8 @@ g_system_thread_new (GThreadFunc   func,
                    "Error creating thread: %s", win_error);
       g_free (retval);
       g_free (win_error);
-      return thread;
+      g_slice_free (GRealThread, thread);
+      return NULL;
     }
 
   *(GThreadData **) &(thread->system_thread) = retval;