Closed Bug 226356 Opened 17 years ago Closed 17 years ago

DRefTool bug: PR_NewNamedMonitor crashes if PR_NewMonitor fails

Categories

(NSPR :: NSPR, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: timeless, Assigned: wtc)

Details

Attachments

(1 file)

This bug is based on DRefTool output from boffo tinderbox 
http://tinderbox.mozilla.org/showlog.cgi?log=MozillaTest/1069357080.16738.gz on 
MozillaTest http://tinderbox.mozilla.org/showbuilds.cgi?tree=MozillaTest

Specifically:
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/nsprpub/pr/src/bthreads/btmon.c&rev=3.4&mark=81#76
Deref-error: "mon"
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/nsprpub/pr/src/pthreads/ptsynch.c&rev=3.19.2.3&mark=474#469
Deref-error: "mon"
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/nsprpub/pr/src/threads/prmon.c&rev=3.4&mark=71#66
Deref-error: "mon"

Here's one version of the function:
    78            PR_IMPLEMENT(PRMonitor*) PR_NewNamedMonitor(const char* name)
    79            {
    80                PRMonitor* mon = PR_NewMonitor();
    81                mon->name = name;
    82                return mon;
    83            }

Note that PR_NewMonitor will not crash if it runs out of memory but will return 
null.
Attachment #136013 - Flags: review?(wchang0222)
Comment on attachment 136013 [details] [diff] [review]
check for success before assigning name

r=wtc.	Verified that all implementations of
PR_NewNamedMonitor are fixed.
Attachment #136013 - Flags: review?(wchang0222) → review+
Patch checked in on the NSPR tip for NSPR 4.5.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Target Milestone: --- → 4.5
You need to log in before you can comment on or make changes to this bug.