[PATCH] Fix pthread_create
Jakub Jelinek
jakub@redhat.com
Thu Oct 28 15:42:00 GMT 2004
Hi!
If
if (pd->schedparam.sched_priority < minprio
|| pd->schedparam.sched_priority > maxprio)
{
err = EINVAL;
goto errout;
}
jumps to errout, is_detached, which is not in scope at this
point, will have undefined value. I guess we want to deallocate
the stack always if create_thread has not been called.
2004-10-28 Jakub Jelinek <jakub@redhat.com>
* pthread_create.c (__pthread_create_2_1): Avoid leaking stacks
if sched_priority is not between minprio and maxprio.
--- libc/nptl/pthread_create.c.jj 2004-09-30 00:50:02.000000000 +0200
+++ libc/nptl/pthread_create.c 2004-10-28 17:31:51.016851090 +0200
@@ -459,10 +459,12 @@ __pthread_create_2_1 (newthread, attr, s
err = create_thread (pd, iattr, STACK_VARIABLES_ARGS);
if (err != 0)
{
- errout:
/* Something went wrong. Free the resources. */
if (!is_detached)
- __deallocate_stack (pd);
+ {
+ errout:
+ __deallocate_stack (pd);
+ }
return err;
}
Jakub
More information about the Libc-hacker
mailing list