Open
Bug 257385
Opened 20 years ago
Updated 2 years ago
various mork functions silently leak in error case
Categories
(MailNews Core :: Database, defect, P5)
MailNews Core
Database
Tracking
(Not tracked)
NEW
People
(Reporter: dbaron, Unassigned)
Details
(Keywords: memory-leak)
Filing in MailNews: Mail Database for lack of a better component for mork bugs. Various mork functions, such as: morkTableRowCursor::NextRow morkTableRowCursor::PrevRow morkTableRowCursor::MakeUniqueCursor morkTable::GetMetaRow morkTable::GetTableRowCursor morkTable::PosToRow morkTable::NewRow morkFactory::CreateNewFile morkFactory::MakeHeap morkFactory::OpenFilePort morkFactory::ThumbToOpenPort morkFactory::OpenFileStore morkFactory::ThumbToOpenStore morkFactory::CreateNewFileStore and probably others end with code like: if ( acqStore ) *acqStore = outStore; All of these functions will silently leak if the out parameter is null. I think these functions should definitely assert if the out parameter is null so they can't lead to silent leaks. However, I also don't see any reason to null-check out parameters (other than for DEBUG-only assertions) when getting the out parameter is the sole purpose of calling the function -- so I think the better solution to this bug is to remove the null checks rather than adding |else outStore->Release();| after each one.
Updated•20 years ago
|
Product: MailNews → Core
Updated•16 years ago
|
QA Contact: database
Assignee | ||
Updated•16 years ago
|
Product: Core → MailNews Core
Updated•12 years ago
|
Assignee: dbienvenu → nobody
Comment 2•4 years ago
|
||
Removing null checks will introduce UB that would be worse than leaks.
Comment 3•4 years ago
|
||
What is UB?
Anyway, I suppose we would take a patch to fix it, but given we're trying to get rid of Mork entirely, focusing on that seems like time better spent.
Flags: needinfo?(mkmelin+mozilla)
Priority: -- → P5
Comment 4•4 years ago
|
||
Unpredictable behavior? (just a guess)
Comment 5•4 years ago
|
||
UB == undefined behavior.
http://blog.llvm.org/2011/05/what-every-c-programmer-should-know_14.html
Updated•2 years ago
|
Severity: minor → S4
You need to log in
before you can comment on or make changes to this bug.
Description
•