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)

Tracking

(Not tracked)

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.
Product: MailNews → Core
QA Contact: database
Product: Core → MailNews Core
Assignee: dbienvenu → nobody

wontfix?

Flags: needinfo?(mkmelin+mozilla)

Removing null checks will introduce UB that would be worse than leaks.

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

Unpredictable behavior? (just a guess)

Severity: minor → S4
You need to log in before you can comment on or make changes to this bug.