summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gc.c b/gc.c
index fb74b0623a..d893dd7e55 100644
--- a/gc.c
+++ b/gc.c
@@ -1089,8 +1089,9 @@ init_heap(rb_objspace_t *objspace)
{
/* altstack of another threads are allocated in another place */
rb_thread_t *th = GET_THREAD();
- free(th->altstack); /* free previously allocated area */
- th->altstack = xmalloc(ALT_STACK_SIZE);
+ void *tmp = th->altstack;
+ th->altstack = malloc(ALT_STACK_SIZE);
+ free(tmp); /* free previously allocated area */
}
#endif