Probable leak in nsAbDirectoryDataSource::createDirectoryChildNode

RESOLVED DUPLICATE of bug 235461

Status

SeaMonkey
MailNews: Address Book & Contacts
RESOLVED DUPLICATE of bug 235461
15 years ago
13 years ago

People

(Reporter: bz, Assigned: (not reading, please use seth@sspitzer.org instead))

Tracking

({mlk})

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.
Keywords: mlk

Comment 1

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

Comment 3

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