Fix missing mem freeing on error path.

oldstable
Michael Stefaniuc 2003-10-01 03:14:29 +00:00 committed by Alexandre Julliard
parent 4ff35b52a5
commit 082e0bfe93
4 changed files with 10 additions and 3 deletions

View File

@ -758,8 +758,10 @@ BOOL WINAPI CryptEnumProviderTypesA (DWORD dwIndex, DWORD *pdwReserved,
keylen++;
if ( !(keyname = CRYPT_Alloc(keylen)) )
CRYPT_ReturnLastError(ERROR_NOT_ENOUGH_MEMORY);
if ( RegEnumKeyA(hKey, dwIndex, keyname, keylen) )
if ( RegEnumKeyA(hKey, dwIndex, keyname, keylen) ) {
CRYPT_Free(keyname);
return FALSE;
}
RegOpenKeyA(hKey, keyname, &hSubkey);
ch = keyname + strlen(keyname);
/* Convert "Type 000" to 0, etc/ */

View File

@ -377,6 +377,7 @@ BOOL16 WINAPI PrintDlg16(
if (!GetPrinterDriverA(hprn, NULL, 3, (LPBYTE)dbuf, needed, &needed)) {
ERR("GetPrinterDriverA failed for %s, le %ld, fix your config!\n",
pbuf->pPrinterName,GetLastError());
HeapFree(GetProcessHeap(), 0, dbuf);
COMDLG32_SetCommDlgExtendedError(PDERR_RETDEFFAILURE);
return FALSE;
}

View File

@ -1582,8 +1582,10 @@ LPENUMFORMATETC OLEClipbrd_IEnumFORMATETC_Construct(UINT cfmt, const FORMATETC a
ef->posFmt = 0;
ef->countFmt = cfmt;
if (FAILED(CoGetMalloc(MEMCTX_TASK, &pIMalloc)))
if (FAILED(CoGetMalloc(MEMCTX_TASK, &pIMalloc))) {
HeapFree(GetProcessHeap(), 0, ef);
return NULL;
}
ef->pFmt = (LPFORMATETC)IMalloc_Alloc(pIMalloc, size);
IMalloc_Release(pIMalloc);

View File

@ -323,8 +323,10 @@ HRESULT WINAPI FileMonikerImpl_Load(IMoniker* iface,IStream* pStm)
filePathW=HeapAlloc(GetProcessHeap(),0,(length+1)*sizeof(WCHAR));
filePathW[length]=0;
res=IStream_Read(pStm,filePathW,doubleLenHex,&bread);
if (bread!=doubleLenHex)
if (bread!=doubleLenHex) {
HeapFree(GetProcessHeap(), 0, filePathW);
return E_FAIL;
}
if (This->filePathName!=NULL)
HeapFree(GetProcessHeap(),0,This->filePathName);