Huw Davies : shell32: Fix a memory leak.

Alexandre Julliard julliard at winehq.org
Thu Dec 17 10:37:09 CST 2009


Module: wine
Branch: master
Commit: b71173f7ac0493fac4abe3f237b6cfb22b25fcd7
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b71173f7ac0493fac4abe3f237b6cfb22b25fcd7

Author: Huw Davies <huw at codeweavers.com>
Date:   Thu Dec 17 10:12:04 2009 +0000

shell32: Fix a memory leak.

Found by Valgrind.

---

 dlls/shell32/shelllink.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/dlls/shell32/shelllink.c b/dlls/shell32/shelllink.c
index 3b16170..6dd62a7 100644
--- a/dlls/shell32/shelllink.c
+++ b/dlls/shell32/shelllink.c
@@ -2213,7 +2213,10 @@ static HRESULT WINAPI IShellLinkW_fnSetPath(IShellLinkW * iface, LPCWSTR pszFile
 
     /* any other quote marks are invalid */
     if (strchrW(pszFile, '"'))
+    {
+        HeapFree(GetProcessHeap(), 0, unquoted);
         return S_FALSE;
+    }
 
     HeapFree(GetProcessHeap(), 0, This->sPath);
     This->sPath = NULL;
@@ -2241,7 +2244,10 @@ static HRESULT WINAPI IShellLinkW_fnSetPath(IShellLinkW * iface, LPCWSTR pszFile
         This->sPath = HeapAlloc( GetProcessHeap(), 0,
                              (lstrlenW( buffer )+1) * sizeof (WCHAR) );
         if (!This->sPath)
+        {
+            HeapFree(GetProcessHeap(), 0, unquoted);
             return E_OUTOFMEMORY;
+        }
 
         lstrcpyW(This->sPath, buffer);
     }




More information about the wine-cvs mailing list