From 077549e0d468ff47fdf3e00bb3cfdb929ac8324f Mon Sep 17 00:00:00 2001
From: Rich Felker <dalias@aerifal.cx>
Date: Fri, 1 Feb 2013 22:23:24 -0500
Subject: if pthread_create fails, it must not attempt mmap if there is no
 mapping

this bug was introduced when support for application-provided stacks
was originally added.
---
 src/thread/pthread_create.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/thread')

diff --git a/src/thread/pthread_create.c b/src/thread/pthread_create.c
index 4c1decaa..1e55a6f9 100644
--- a/src/thread/pthread_create.c
+++ b/src/thread/pthread_create.c
@@ -188,7 +188,7 @@ int pthread_create(pthread_t *restrict res, const pthread_attr_t *restrict attrp
 
 	if (ret < 0) {
 		a_dec(&libc.threads_minus_1);
-		munmap(map, size);
+		if (map) munmap(map, size);
 		return EAGAIN;
 	}
 
-- 
cgit v1.2.3-70-g09d2