ofxDirList Memory Leak

hello, using the MallocDebug utitlity, I have found a memory leak in the ofxDirList module.

The solution is to modify the destructor so it looks like the following:

  
  
//Clean up  
//----------------------------------------------------------  
ofxDirList::~ofxDirList()  
{  
	for(int k = 0; k < OF_DL_MAX_EXTS; k++)  
		delete allowedFileExt[k];  
	  
	for(int k = 0; k < OF_DL_MAX_RESULTS; k++){  
		delete nameArray[k];  
		delete pathArray[k];  
	}  
	  
	delete pathArray;  
	delete nameArray;  
	delete allowedFileExt;  
}  
  

The original was deleting the arrays, but not their dynamically allocated data.

Hi, i think you meant

  
  
	delete [] pathArray;  
	delete [] nameArray;  
	delete [] allowedFileExt;  
  

instead of:

  
  
	delete pathArray;  
	delete nameArray;  
	delete allowedFileExt;  
  

Otherwise, you’d still have a leak in there.

Cheers,
P.