Fixed a bug in threads that occured when switching from a thread
[cacao.git] / threads / thread.c
index d9565d8649c9f0000dcff6bddffac9595987db76..4ebb09791a24c2a93fbba6d9f477648c8be35a64 100644 (file)
@@ -330,6 +330,14 @@ firstStartThread(void)
 
     DBG( printf("firstStartThread %p\n", currentThread); );
 
+       if (stack_to_be_freed != 0)
+       {
+#ifndef USE_BOEHM
+               free(stack_to_be_freed);
+#endif
+               stack_to_be_freed = 0;
+       }
+
        /* Every thread starts with the interrupts off */
        intsRestore();
        assert(blockInts == 0);