Browse Source

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.
Rich Felker 12 years ago
parent
commit
077549e0d4
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/thread/pthread_create.c

+ 1 - 1
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;
 	}