From 926ce9e3ac32e1a33cc43420f76876fac8868436 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 7 Mar 2006 23:30:43 +0000 Subject: [PATCH] fix another memory leak in SetCommand() (coverity checker CID 52) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37881 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/unix/mimetype.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/unix/mimetype.cpp b/src/unix/mimetype.cpp index 3b3cb106d9..ec6d47e5cb 100644 --- a/src/unix/mimetype.cpp +++ b/src/unix/mimetype.cpp @@ -1465,17 +1465,16 @@ wxFileTypeImpl::SetCommand(const wxString& cmd, wxArrayString strExtensions; wxString strDesc, strIcon; - wxMimeTypeCommands *entry = new wxMimeTypeCommands(); - entry->Add(verb + wxT("=") + cmd + wxT(" %s ")); - wxArrayString strTypes; GetMimeTypes(strTypes); - if (strTypes.GetCount() < 1) + if ( strTypes.IsEmpty() ) return false; - size_t i; + wxMimeTypeCommands *entry = new wxMimeTypeCommands(); + entry->Add(verb + wxT("=") + cmd + wxT(" %s ")); + 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)) ok = false; -- 2.45.2