public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix pthread_create
@ 2004-10-28 15:42 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2004-10-28 15:42 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Glibc hackers

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-10-28 15:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-28 15:42 [PATCH] Fix pthread_create Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).