[sldev] Memory leaking issues with llviewerpartsim.cpp / VWR-794

Nicholaz Beresford nicholaz at blueflash.cc
Sun May 20 15:39:05 PDT 2007


I have found two errors in llviewerpartsim.  One is very minor, in an error
case memory is not freed.  The other seems more severe.  On cleanupRegion()
the pointer for the region is deleted from the regionlist, but the 
object itself
is not freed, which means the region, the associated particle sources and
particles will linger in memory.

Patch is attached here (can't currently attach to JIRA, as it seems broken
with attachments and indexing of issues).

Further description: https://jira.secondlife.com/browse/VWR-794

Please review/vote
-------------- next part --------------
--- linden-orig/indra/newview/llviewerpartsim.cpp	2007-05-14 16:47:28.000000000 +0200
+++ linden/indra/newview/llviewerpartsim.cpp	2007-05-21 00:19:24.093750000 +0200
@@ -521,6 +521,7 @@
 		llwarns << "LLViewerPartSim::put - Particle didn't go into its box!" << llendl;
 		llinfos << groupp->getCenterAgent() << llendl;
 		llinfos << part->mPosAgent << llendl;
+		delete groupp; // potential memory leak fixed (loss of groupp) [Nicholaz Beresford]
 		return NULL;
 	}
 	return groupp;
@@ -693,6 +694,8 @@
 
 		if ((*iter)->getRegion() == regionp)
 		{
+			delete (*iter);		// need to delete object associated with pointer [Nicholaz Beresford]
+								// not just erase pointer from pointer-list
 			i = mViewerPartGroups.erase(iter);			
 		}
 	}


More information about the SLDev mailing list