Closed Bug 333674 Opened 19 years ago Closed 19 years ago

We leak oldVal on OOM in nsUint32ToContentHashEntry::PutContent

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
critical

Tracking

()

RESOLVED FIXED

People

(Reporter: jwatt, Assigned: jwatt)

References

(Blocks 1 open bug, )

Details

(Keywords: coverity, memory-leak)

Attachments

(1 file, 1 obsolete file)

The call to GetContent could return null, in which case NS_RELEASE dereference null.
Attached patch patch (obsolete) (deleted) — Splinter Review
Attachment #218127 - Flags: superreview?(roc)
Attachment #218127 - Flags: review?(roc)
> The call to GetContent could return null Not really. The code is: 186 if (GetContent()) { 187 nsIContent* oldVal = GetContent(); Now perhaps we want to only call GetContent() once and then just test oldVal? Would probably make coverity happier and mean only two conditional tests there instead of the current 3.... I'd really have expected coverity to not flag this, though. Is there a way to report to them that this is bogus? Does flagging the report as "FALSE" in scan.coverity.com do that?
Attachment #218127 - Flags: superreview?(roc)
Attachment #218127 - Flags: superreview-
Attachment #218127 - Flags: review?(roc)
Attachment #218127 - Flags: review-
Attached patch patch for leak (deleted) — Splinter Review
True, I should have noticed that. :-/ Nevertheless, there's still a leak on OOM that we should fix.
Attachment #218127 - Attachment is obsolete: true
Attachment #218133 - Flags: superreview?(roc)
Attachment #218133 - Flags: review?(roc)
I don't know if there's a special way to report false positives to coverity. I'd hope they keep looking at the reports marked FALSE though to improve their code.
Keywords: crashmlk
Summary: Null dereference in nsUint32ToContentHashEntry::PutContent → Leak oldVal on OOM in nsUint32ToContentHashEntry::PutContent
Comment on attachment 218133 [details] [diff] [review] patch for leak SetContent addrefs, so this will double-addref the content and leak.
Attachment #218133 - Flags: superreview?(roc)
Attachment #218133 - Flags: superreview-
Attachment #218133 - Flags: review?(roc)
Attachment #218133 - Flags: review-
Comment on attachment 218133 [details] [diff] [review] patch for leak Never mind me. I need to learn to read.
Attachment #218133 - Flags: superreview-
Attachment #218133 - Flags: superreview+
Attachment #218133 - Flags: review-
Attachment #218133 - Flags: review+
fwiw they do read through FALSEs, but if there's a specific pattern we want them to learn, we're supposed to email something.
Checked in.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Summary: Leak oldVal on OOM in nsUint32ToContentHashEntry::PutContent → We leak oldVal on OOM in nsUint32ToContentHashEntry::PutContent
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: