NSPR doesn't protect itself against multiple PR_Init/PR_Cleanup calls

NEW
Unassigned

Status

NSPR
NSPR
a year ago
a year ago

People

(Reporter: kaie, Unassigned)

Tracking

4.15

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

a year ago
If an application calls PR_Init() and PR_Cleanup 1024 times, we crash in _PR_InitThreads, because this line fails:

  rv = _PT_PTHREAD_KEY_CREATE(&pt_book.key, _pt_thread_death);

We seem to run out of thread private data elements.

I think in general it should be avoided to init and cleanup NSPR multiple times, I think there shouldn't be a need for it, and just call both once.

Nevertheless, if NSPR allocates one time elements that it doesn't free, it might be nice to have some kind of runtime protection, which detects if NSPR has already done those allocations and hasn't freed them, and avoids reallocation.
You need to log in before you can comment on or make changes to this bug.