about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/thread/pthread_create.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/thread/pthread_create.c b/src/thread/pthread_create.c
index c8c117b9..1601614a 100644
--- a/src/thread/pthread_create.c
+++ b/src/thread/pthread_create.c
@@ -3,6 +3,7 @@
 #include "stdio_impl.h"
 #include "libc.h"
 #include <sys/mman.h>
+#include <string.h>
 
 static void dummy_0()
 {
@@ -175,6 +176,7 @@ int pthread_create(pthread_t *restrict res, const pthread_attr_t *restrict attrp
 		if (need < size/8 && need < 2048) {
 			tsd = stack - __pthread_tsd_size;
 			stack = tsd - libc.tls_size;
+			memset(stack, 0, need);
 		} else {
 			size = ROUND(need);
 			guard = 0;