diff --git a/dlls/urlmon/sec_mgr.c b/dlls/urlmon/sec_mgr.c index 52e29b64a2..6330906ea5 100644 --- a/dlls/urlmon/sec_mgr.c +++ b/dlls/urlmon/sec_mgr.c @@ -318,6 +318,8 @@ static HRESULT WINAPI SecManagerImpl_GetSecurityId(IInternetSecurityManager *ifa 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); @@ -341,8 +343,10 @@ static HRESULT WINAPI SecManagerImpl_GetSecurityId(IInternetSecurityManager *ifa 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);