urlmon: Fix some memory leaks

Andrew Talbot andrew.talbot at talbotville.com
Fri Oct 5 15:52:08 CDT 2007


Changelog:
    urlmon: Fix some memory leaks.

diff --git a/dlls/urlmon/sec_mgr.c b/dlls/urlmon/sec_mgr.c
index 609ca4f..e42e910 100644
--- a/dlls/urlmon/sec_mgr.c
+++ b/dlls/urlmon/sec_mgr.c
@@ -316,6 +316,8 @@ static HRESULT WINAPI SecManagerImpl_Get
 
         static const BYTE secidFile[] = {'f','i','l','e',':'};
 
+        HeapFree(GetProcessHeap(), 0, buf);
+
         if(*pcbSecurityId < sizeof(secidFile)+sizeof(zone))
             return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
 
@@ -339,8 +341,10 @@ static HRESULT WINAPI SecManagerImpl_Get
 
     len = WideCharToMultiByte(CP_ACP, 0, buf, -1, NULL, 0, NULL, NULL)-1;
 
-    if(len+sizeof(DWORD) > *pcbSecurityId)
+    if(len+sizeof(DWORD) > *pcbSecurityId) {
+        HeapFree(GetProcessHeap(), 0, buf);
         return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
+    }
 
     WideCharToMultiByte(CP_ACP, 0, buf, -1, (LPSTR)pbSecurityId, -1, NULL, NULL);
     HeapFree(GetProcessHeap(), 0, buf);



More information about the wine-patches mailing list