dlls/shell32/pidl.c

Ge van Geldorp gvg at reactos.com
Sat Aug 13 13:55:48 CDT 2005


Changelog:
  Ge van Geldorp <gvg at reactos.com>
  - Fix resource leaks on error paths

Index: dlls/shell32/pidl.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/pidl.c,v
retrieving revision 1.133
diff -u -r1.133 pidl.c
--- dlls/shell32/pidl.c	8 Jul 2005 14:18:32 -0000	1.133
+++ dlls/shell32/pidl.c	13 Aug 2005 18:49:08 -0000
@@ -1258,13 +1258,21 @@
 
     dwAttributes = SFGAO_FILESYSTEM;
     hr = IShellFolder_GetAttributesOf(psfFolder, 1, &pidlLast, &dwAttributes);
-    if (FAILED(hr) || !(dwAttributes & SFGAO_FILESYSTEM)) return FALSE;
+    if (FAILED(hr) || !(dwAttributes & SFGAO_FILESYSTEM)) {
+        IShellFolder_Release(psfFolder);
+        ILFree((LPITEMIDLIST) pidlLast);
+        return FALSE;
+    }
                 
     hr = IShellFolder_GetDisplayNameOf(psfFolder, pidlLast, SHGDN_FORPARSING, &strret);
-    if (FAILED(hr)) return FALSE;
+    IShellFolder_Release(psfFolder);
+    if (FAILED(hr)) {
+        ILFree((LPITEMIDLIST) pidlLast);
+        return FALSE;
+    }
 
     hr = StrRetToBufW(&strret, pidlLast, pszPath, MAX_PATH);
-    IShellFolder_Release(psfFolder);
+    ILFree((LPITEMIDLIST) pidlLast);
 
     TRACE_(shell)("-- %s, 0x%08lx\n",debugstr_w(pszPath), hr);
     return SUCCEEDED(hr);



More information about the wine-patches mailing list