Bugzilla bug #82436: assert that lock is not NULL in PR_Lock and PR_Unlock

to avoid crashing in an assertion statement like
PR_ASSERT(lock->owner != me) if lock is NULL.
This commit is contained in:
wtc%netscape.com 2001-06-05 23:55:55 +00:00
parent 21b77a4d22
commit f864ebcadb

View File

@ -230,6 +230,7 @@ PR_IMPLEMENT(void) PR_Lock(PRLock *lock)
#if !defined(XP_MAC) #if !defined(XP_MAC)
PR_ASSERT(!(me->flags & _PR_IDLE_THREAD)); PR_ASSERT(!(me->flags & _PR_IDLE_THREAD));
#endif #endif
PR_ASSERT(lock != NULL);
#ifdef _PR_GLOBAL_THREADS_ONLY #ifdef _PR_GLOBAL_THREADS_ONLY
PR_ASSERT(lock->owner != me); PR_ASSERT(lock->owner != me);
_PR_MD_LOCK(&lock->ilock); _PR_MD_LOCK(&lock->ilock);
@ -336,6 +337,7 @@ PR_IMPLEMENT(PRStatus) PR_Unlock(PRLock *lock)
PRIntn is; PRIntn is;
PRThread *me = _PR_MD_CURRENT_THREAD(); PRThread *me = _PR_MD_CURRENT_THREAD();
PR_ASSERT(lock != NULL);
PR_ASSERT(lock->owner == me); PR_ASSERT(lock->owner == me);
PR_ASSERT(me != suspendAllThread); PR_ASSERT(me != suspendAllThread);
#if !defined(XP_MAC) #if !defined(XP_MAC)