about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2013-02-01 22:23:24 -0500
committerRich Felker <dalias@aerifal.cx>2013-02-01 22:23:24 -0500
commit077549e0d468ff47fdf3e00bb3cfdb929ac8324f (patch)
tree665026b329447d28a41f740ac1778a3fb0b87468 /src
parentd5142642b8e6c45449158efdb8f8e87af4dafde8 (diff)
downloadmusl-077549e0d468ff47fdf3e00bb3cfdb929ac8324f.tar.gz
musl-077549e0d468ff47fdf3e00bb3cfdb929ac8324f.tar.xz
musl-077549e0d468ff47fdf3e00bb3cfdb929ac8324f.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/thread/pthread_create.c2
1 files changed, 1 insertions, 1 deletions
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;
 	}