fixed memory leaks in case of errors during file load in wxSound::Create() (coverity checker CID 54)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37878 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -467,12 +467,14 @@ bool wxSound::Create(const wxString& fileName,
|
|||||||
wxUint8 *data = new wxUint8[len];
|
wxUint8 *data = new wxUint8[len];
|
||||||
if ( fileWave.Read(data, len) != lenOrig )
|
if ( fileWave.Read(data, len) != lenOrig )
|
||||||
{
|
{
|
||||||
|
delete [] data;
|
||||||
wxLogError(_("Couldn't load sound data from '%s'."), fileName.c_str());
|
wxLogError(_("Couldn't load sound data from '%s'."), fileName.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!LoadWAV(data, len, false))
|
if (!LoadWAV(data, len, false))
|
||||||
{
|
{
|
||||||
|
delete [] data;
|
||||||
wxLogError(_("Sound file '%s' is in unsupported format."),
|
wxLogError(_("Sound file '%s' is in unsupported format."),
|
||||||
fileName.c_str());
|
fileName.c_str());
|
||||||
return false;
|
return false;
|
||||||
|
Reference in New Issue
Block a user