Bugs item #2796311, was opened at 2009-05-25 15:02
Message generated for change (Tracker Item Submitted) made by panduwana
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=462816&aid=2796311&group_id=51305

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: any
Group: Subversion TRUNK
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Perdana Panduwana (panduwana)
Assigned to: Nobody/Anonymous (nobody)
Summary: wxSQLite3 -- possible memory leak

Initial Comment:
>From trunk/wxCode/components/wxsqlite3/src/wxsqlite3.cpp:
Function: wxMemoryBuffer& wxSQLite3Blob::Read(wxMemoryBuffer& blobValue, int 
length, int offset);

1763   char* localBuffer = new char[length];
...
1769     throw wxSQLite3Exception(rc, UTF8toWxString(localError));
...
1773   delete [] localBuffer;

so, if exception thrown, localBuffer never deleted.

A better way is to directly write to wxMemoryBuffer's internal memory using 
wxMemoryBuffer::GetWriteBuf(sizeNeeded) followed by 
wxMemoryBuffer::UngetWriteBuf(sizeUsed).
This completely remove the need of localBuffer.

I've attached the diff of my suggestion.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=462816&aid=2796311&group_id=51305

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
_______________________________________________
wxCode-users mailing list
wxCode-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxcode-users

Reply via email to