]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed a crash and a leak in GetShortcutTarget() (closes bug 1541321)
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 22 Aug 2006 12:21:24 +0000 (12:21 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 22 Aug 2006 12:21:24 +0000 (12:21 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40744 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/filename.cpp

index 1be91db75f158297d260f8768edd0e6347ec27ed..f55a693ae8203e11604756cf6d4293dd2b301063 100644 (file)
@@ -1047,7 +1047,9 @@ bool wxFileName::Normalize(int flags,
 #include <shlguid.h>
 #endif
 
-bool wxFileName::GetShortcutTarget(const wxString& shortcutPath, wxString& targetFilename, wxString* arguments)
+bool wxFileName::GetShortcutTarget(const wxString& shortcutPath,
+                                   wxString& targetFilename,
+                                   wxString* arguments)
 {
     wxString path, file, ext;
     wxSplitPath(shortcutPath, & path, & file, & ext);
@@ -1076,6 +1078,8 @@ bool wxFileName::GetShortcutTarget(const wxString& shortcutPath, wxString& targe
                                 MAX_PATH);
 
             hres = ppf->Load(wsz, 0);
+            ppf->Release();
+
             if (SUCCEEDED(hres))
             {
                 wxChar buf[2048];
@@ -1096,11 +1100,13 @@ bool wxFileName::GetShortcutTarget(const wxString& shortcutPath, wxString& targe
                 }
             }
         }
+
+        psl->Release();
     }
-    psl->Release();
     return success;
 }
-#endif
+
+#endif // __WIN32__ && !__WXWINCE__
 
 
 // ----------------------------------------------------------------------------