msacm32: Add missing HeapALloc failure checks (Coverity).

This commit is contained in:
Marcus Meissner 2009-01-31 21:53:36 +01:00 committed by Alexandre Julliard
parent 102a3b9892
commit f0b685d504
1 changed files with 11 additions and 0 deletions

View File

@ -289,18 +289,29 @@ PWINE_ACMDRIVERID MSACM_RegisterDriver(LPCWSTR pszDriverAlias, LPCWSTR pszFileNa
debugstr_w(pszDriverAlias), debugstr_w(pszFileName), pLocalDriver);
padid = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVERID));
if (!padid)
return NULL;
padid->obj.dwType = WINE_ACMOBJ_DRIVERID;
padid->obj.pACMDriverID = padid;
padid->pszDriverAlias = NULL;
if (pszDriverAlias)
{
padid->pszDriverAlias = HeapAlloc( MSACM_hHeap, 0, (strlenW(pszDriverAlias)+1) * sizeof(WCHAR) );
if (!padid->pszDriverAlias) {
HeapFree(MSACM_hHeap, 0, padid);
return NULL;
}
strcpyW( padid->pszDriverAlias, pszDriverAlias );
}
padid->pszFileName = NULL;
if (pszFileName)
{
padid->pszFileName = HeapAlloc( MSACM_hHeap, 0, (strlenW(pszFileName)+1) * sizeof(WCHAR) );
if (!padid->pszFileName) {
HeapFree(MSACM_hHeap, 0, padid->pszDriverAlias);
HeapFree(MSACM_hHeap, 0, padid);
return NULL;
}
strcpyW( padid->pszFileName, pszFileName );
}
padid->pLocalDriver = pLocalDriver;