Rob Shearman : shell32: Fix a memory leak in Stream_WriteLocationInfo.

Alexandre Julliard julliard at winehq.org
Mon Nov 12 06:27:42 CST 2007


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

Author: Rob Shearman <rob at codeweavers.com>
Date:   Sun Nov 11 12:28:36 2007 +0000

shell32: Fix a memory leak in Stream_WriteLocationInfo.

---

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

diff --git a/dlls/shell32/shelllink.c b/dlls/shell32/shelllink.c
index 7778b58..4268fe9 100644
--- a/dlls/shell32/shelllink.c
+++ b/dlls/shell32/shelllink.c
@@ -977,6 +977,7 @@ static HRESULT Stream_WriteLocationInfo( IStream* stm, LPCWSTR path,
     LOCATION_INFO *loc;
     LPSTR szLabel, szPath, szFinalPath;
     ULONG count = 0;
+    HRESULT hr;
 
     TRACE("%p %s %p\n", stm, debugstr_w(path), volume);
 
@@ -1018,7 +1019,10 @@ static HRESULT Stream_WriteLocationInfo( IStream* stm, LPCWSTR path,
                          szPath, path_size, NULL, NULL );
     szFinalPath[0] = 0;
 
-    return IStream_Write( stm, loc, total_size, &count );
+    hr = IStream_Write( stm, loc, total_size, &count );
+    HeapFree(GetProcessHeap(), 0, loc);
+
+    return hr;
 }
 
 static EXP_DARWIN_LINK* shelllink_build_darwinid( LPCWSTR string, DWORD magic )




More information about the wine-cvs mailing list