Fix memory leak in case of error in wxOSX graphics code.

Delete the pointer before returning from the function if we don't pass its
ownership to CGDataProviderCreateWithData().

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75955 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-02-21 00:51:46 +00:00
parent a4cc201e76
commit 3dd1d4d915

View File

@@ -2977,7 +2977,10 @@ CGDataProviderRef wxMacCGDataProviderCreateWithMemoryBuffer( const wxMemoryBuffe
{
wxMemoryBuffer* b = new wxMemoryBuffer( buf );
if ( b->GetDataLen() == 0 )
{
delete b;
return NULL;
}
return CGDataProviderCreateWithData( b , (const void *) b->GetData() , b->GetDataLen() ,
wxMacReleaseMemoryBufferProviderCallback );