DRefTool bug: PR_NewNamedMonitor crashes if PR_NewMonitor fails

RESOLVED FIXED in 4.5

Status

NSPR
NSPR
RESOLVED FIXED
15 years ago
15 years ago

People

(Reporter: timeless, Assigned: Wan-Teh Chang)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

15 years ago
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.
(Reporter)

Comment 1

15 years ago
Created attachment 136013 [details] [diff] [review]
check for success before assigning name
(Reporter)

Updated

15 years ago
Attachment #136013 - Flags: review?(wchang0222)
(Assignee)

Comment 2

15 years ago
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+
(Assignee)

Comment 3

15 years ago
Patch checked in on the NSPR tip for NSPR 4.5.
Status: NEW → RESOLVED
Last Resolved: 15 years ago
Resolution: --- → FIXED
Target Milestone: --- → 4.5
You need to log in before you can comment on or make changes to this bug.