Closed Bug 91790 Opened 23 years ago Closed 23 years ago

Malloc of 0 - nsMsgDBView.cpp

Categories

(MailNews Core :: Backend, defect)

defect
Not set
critical

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: mkaply, Assigned: mscott)

Details

Attachments

(1 file)

This code:

http://lxr.mozilla.org/seamonkey/source/mailnews/base/src/nsMsgDBView.
cpp#2206

Is bad.

for empty folders, arraySize is 0, so not only does a malloc of 0 
happen, but lots of unnecessary code is traversed.

I am not sure what the right thing is to do here - possibly just 
return NS_OK if arraySize is 0?
OS: other → All
Hardware: Other → All
I've attached a fix for this.

On OS/2 we were asserting all over the place on the 0 mallocs.

This fixes all of our problems, and gives the same behavior as before.

To test, go to an empty folder and try all the different sorts, as 
well as threaded view. everything should work as before.
Without this fix, mail is unstable on OS/2.

The 0 mallocs causes us to get "Unknown error" popups and random 
crashes on release builds.

I need this fix.
Severity: normal → critical
Mike, do you want me to check this patch in or do you want to?

sr=mscott either way. 

although I prefer the if (!foo) notation insead of if (foo == 0). Either way
though. 
I'll check it in, no prob, and I'll fix the syntax.

Do you definitely agree that this is the right thing to do (return NS_OK if 
there is nothing to sort)
yup, I agree that it's the right thing to do. 
Fix checked in
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
QA Contact: esther → stephend
verified fixed via code inspection (using LXR).
Status: RESOLVED → VERIFIED
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: