Closed Bug 439266 Opened 16 years ago Closed 16 years ago

Leak of array if rv != NS_OK in BuildSearchElements()

Categories

(MailNews Core :: Address Book, defect)

All
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.9.1a1

People

(Reporter: hwaara, Assigned: hwaara)

Details

(Keywords: memory-leak)

Attachments

(1 file, 1 obsolete file)

BuildSearchElements() in nsAbOSXDirectory.mm will leak an NSArray and all its items if it's returning early with NS_ENSURE_SUCCESS(rv, rv).

Fix coming up.
Attached patch Fix v1 (obsolete) — Splinter Review
Fix to make sure we always escape from the loop (instead of returning early) on error.
Attachment #325130 - Flags: review?(bugzilla)
Comment on attachment 325130 [details] [diff] [review]
Fix v1

     if (!aCanHandle) {
-      return NS_OK;
+      rv = NS_OK;
+      break;
     }

The way I read this, we'll be processing the if (array) statement below in the !aCanHandle case, whereas we wouldn't have before.

I don't think that matters, but could you see if you agree, and if so, please could you add some comments onto BuildSearchElements stating that if aCanHandle is false, the result should be ignored?
Attachment #325130 - Flags: review?(bugzilla) → review-
Attached patch Fix v2Splinter Review
Attachment #325130 - Attachment is obsolete: true
Attachment #326695 - Flags: review?(bugzilla)
Attachment #326695 - Flags: review?(bugzilla) → review+
Checked in.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Hardware: PC → All
Target Milestone: --- → mozilla1.9.1a1
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: