Probable leak in nsAbDirectoryDataSource::createDirectoryChildNode

RESOLVED DUPLICATE of bug 235461

Status

RESOLVED DUPLICATE of bug 235461
17 years ago
14 years ago

People

(Reporter: bzbarsky, Assigned: sspitzer)

Tracking

({memory-leak})

Trunk
memory-leak

Firefox Tracking Flags

(Not tracked)

Details

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.
(Reporter)

Updated

17 years ago
Keywords: mlk

Comment 1

17 years ago
If you want the last, why not just reverse the loop?
mass re-assign.
Assignee: racham → sspitzer
Product: Browser → Seamonkey

Comment 3

14 years ago
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
Last Resolved: 14 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.