Browse Source

linuxthreads.old: fix crash in debug code

If pthread_join() is called and there is nothing to join, then the debug
code will attempt to dereference a NULL pointer.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Mike Frysinger 14 years ago
parent
commit
75c94b00a2
1 changed files with 1 additions and 1 deletions
  1. 1 1
      libpthread/linuxthreads.old/join.c

+ 1 - 1
libpthread/linuxthreads.old/join.c

@@ -77,7 +77,7 @@ void __pthread_do_exit(void *retval, char *currentframe)
   THREAD_SETMEM(self, p_terminated, 1);
   /* See if someone is joining on us */
   joining = THREAD_GETMEM(self, p_joining);
-  PDEBUG("joining = %p, pid=%d\n", joining, joining->p_pid);
+  PDEBUG("joining = %p, pid=%d\n", joining, joining ? joining->p_pid : 0);
   __pthread_unlock(THREAD_GETMEM(self, p_lock));
   /* Restart joining thread if any */
   if (joining != NULL) restart(joining);