From 481864d5e40d1e2569a63170d7b02c08f0d5d064 Mon Sep 17 00:00:00 2001 From: Andrew Talbot Date: Thu, 4 Oct 2007 20:14:38 +0100 Subject: [PATCH] shell32: Fix some memory leaks. --- dlls/shell32/shelllink.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/dlls/shell32/shelllink.c b/dlls/shell32/shelllink.c index b6f4b02729d..7778b581655 100644 --- a/dlls/shell32/shelllink.c +++ b/dlls/shell32/shelllink.c @@ -404,6 +404,7 @@ static BOOL StartLinkProcessor( LPCOLESTR szLink ) LPWSTR buffer; STARTUPINFOW si; PROCESS_INFORMATION pi; + BOOL ret; len = sizeof(szFormat) + lstrlenW( szLink ) * sizeof(WCHAR); buffer = HeapAlloc( GetProcessHeap(), 0, len ); @@ -416,11 +417,18 @@ static BOOL StartLinkProcessor( LPCOLESTR szLink ) memset(&si, 0, sizeof(si)); si.cb = sizeof(si); - if (!CreateProcessW( NULL, buffer, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) return FALSE; - CloseHandle( pi.hProcess ); - CloseHandle( pi.hThread ); - return TRUE; + ret = CreateProcessW( NULL, buffer, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi ); + + HeapFree( GetProcessHeap(), 0, buffer ); + + if (ret) + { + CloseHandle( pi.hProcess ); + CloseHandle( pi.hThread ); + } + + return ret; } static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR pszFileName, BOOL fRemember)