Scott Lawrence avatar Scott Lawrence committed 2e33590 Merge

merge changes for sh-1591

Comments (0)

Files changed (2)

indra/llmessage/lldatapacker.h

 
 				S32			getCurrentSize() const	{ return (S32)(mCurBufferp - mBufferp); }
 				S32			getBufferSize() const	{ return mBufferSize; }
+				const U8*   getBuffer() const   { return mBufferp; }    
 				void		reset()				{ mCurBufferp = mBufferp; mWriteEnabled = (mCurBufferp != NULL); }
 				void		freeBuffer()		{ delete [] mBufferp; mBufferp = mCurBufferp = NULL; mBufferSize = 0; mWriteEnabled = FALSE; }
 				void		assignBuffer(U8 *bufferp, S32 size)
 				{
+					if(mBufferp && mBufferp != bufferp)
+					{
+						freeBuffer() ;
+					}
 					mBufferp = bufferp;
 					mCurBufferp = bufferp;
 					mBufferSize = size;

indra/newview/llvocache.cpp

 	S32 size = -1;
 	BOOL success;
 
+	mDP.assignBuffer(mBuffer, 0);
 	success = check_read(apr_file, &mLocalID, sizeof(U32));
 	if(success)
 	{
 
 LLVOCacheEntry::~LLVOCacheEntry()
 {
-	if(mBuffer)
+	if(mBuffer != mDP.getBuffer())
 	{
-		delete[] mBuffer;
+		delete[] mBuffer ; //just in case
 	}
+	mDP.freeBuffer();
 }
 
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.