Fix missing mem freeing on error path.

This commit is contained in:
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++; keylen++;
if ( !(keyname = CRYPT_Alloc(keylen)) ) if ( !(keyname = CRYPT_Alloc(keylen)) )
CRYPT_ReturnLastError(ERROR_NOT_ENOUGH_MEMORY); CRYPT_ReturnLastError(ERROR_NOT_ENOUGH_MEMORY);
if ( RegEnumKeyA(hKey, dwIndex, keyname, keylen) ) if ( RegEnumKeyA(hKey, dwIndex, keyname, keylen) ) {
CRYPT_Free(keyname);
return FALSE; return FALSE;
}
RegOpenKeyA(hKey, keyname, &hSubkey); RegOpenKeyA(hKey, keyname, &hSubkey);
ch = keyname + strlen(keyname); ch = keyname + strlen(keyname);
/* Convert "Type 000" to 0, etc/ */ /* Convert "Type 000" to 0, etc/ */

View File

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

View File

@ -1582,8 +1582,10 @@ LPENUMFORMATETC OLEClipbrd_IEnumFORMATETC_Construct(UINT cfmt, const FORMATETC a
ef->posFmt = 0; ef->posFmt = 0;
ef->countFmt = cfmt; ef->countFmt = cfmt;
if (FAILED(CoGetMalloc(MEMCTX_TASK, &pIMalloc))) if (FAILED(CoGetMalloc(MEMCTX_TASK, &pIMalloc))) {
HeapFree(GetProcessHeap(), 0, ef);
return NULL; return NULL;
}
ef->pFmt = (LPFORMATETC)IMalloc_Alloc(pIMalloc, size); ef->pFmt = (LPFORMATETC)IMalloc_Alloc(pIMalloc, size);
IMalloc_Release(pIMalloc); 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=HeapAlloc(GetProcessHeap(),0,(length+1)*sizeof(WCHAR));
filePathW[length]=0; filePathW[length]=0;
res=IStream_Read(pStm,filePathW,doubleLenHex,&bread); res=IStream_Read(pStm,filePathW,doubleLenHex,&bread);
if (bread!=doubleLenHex) if (bread!=doubleLenHex) {
HeapFree(GetProcessHeap(), 0, filePathW);
return E_FAIL; return E_FAIL;
}
if (This->filePathName!=NULL) if (This->filePathName!=NULL)
HeapFree(GetProcessHeap(),0,This->filePathName); HeapFree(GetProcessHeap(),0,This->filePathName);