fix memory leak (coverity checker CID 53)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37880 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-03-07 23:27:51 +00:00
parent 47e6466439
commit cb0b7b7d81

View File

@@ -1493,19 +1493,26 @@ bool wxFileTypeImpl::SetDefaultIcon(const wxString& strIcon, int WXUNUSED(index)
wxArrayString strExtensions;
wxString strDesc;
wxMimeTypeCommands *entry = new wxMimeTypeCommands();
wxArrayString strTypes;
GetMimeTypes(strTypes);
if (strTypes.GetCount() < 1)
if ( strTypes.IsEmpty() )
return false;
size_t i;
wxMimeTypeCommands *entry = new wxMimeTypeCommands();
bool ok = true;
for (i = 0; i < strTypes.GetCount(); i++)
for ( size_t i = 0; i < strTypes.GetCount(); i++ )
{
if (!m_manager->DoAssociation(strTypes[i], strIcon, entry, strExtensions, strDesc))
if ( !m_manager->DoAssociation
(
strTypes[i],
strIcon,
entry,
strExtensions,
strDesc
) )
{
ok = false;
}
}
return ok;