Closed Bug 181212 Opened 22 years ago Closed 19 years ago

Probable leak in nsAbDirectoryDataSource::createDirectoryChildNode

Categories

(SeaMonkey :: MailNews: Address Book & Contacts, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 235461

People

(Reporter: bzbarsky, Assigned: sspitzer)

Details

(Keywords: memory-leak)

See comments in bug 175540.  The code in question is:

NS_ASSERTION(total <= 1, "This code probably leaks.  Please break out of the
loop or something, ok?");
for (i = 0; i < total; i++)
{
	nsCOMPtr<nsIRDFResource> mailList = do_QueryElementAt(pAddressLists, i);
	if (mailList)
		NS_ADDREF(*target = mailList);
	else
		return NS_RDF_NO_VALUE;
}

The assertion says it all; this leaks if mailList ever tests true twice in a
single iteration of the loop.
Keywords: mlk
If you want the last, why not just reverse the loop?
mass re-assign.
Assignee: racham → sspitzer
Product: Browser → Seamonkey
It looks like this was fixed by Scott in bug 235461. Suggest duping to that bug
which is resolved fixed. LXR confirms this function was fixed.

*** This bug has been marked as a duplicate of 235461 ***
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.