From cb0b7b7d811356f729315fc14c7e0d311f43384d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 7 Mar 2006 23:27:51 +0000 Subject: [PATCH] fix memory leak (coverity checker CID 53) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37880 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/unix/mimetype.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/unix/mimetype.cpp b/src/unix/mimetype.cpp index 8c2ddad03e..3b3cb106d9 100644 --- a/src/unix/mimetype.cpp +++ b/src/unix/mimetype.cpp @@ -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; -- 2.45.2