msi: Callers of alloc_msihandle should handle failure.

This commit is contained in:
Dan Kegel 2006-08-28 09:44:35 -07:00 committed by Alexandre Julliard
parent 29f0803c02
commit 337e1e202f
7 changed files with 26 additions and 0 deletions

View File

@ -3146,6 +3146,10 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
/* FIXME: Need to write more keys to the user registry */
hDb= alloc_msihandle( &package->db->hdr );
if (!hDb) {
rc = ERROR_NOT_ENOUGH_MEMORY;
goto end;
}
rc = MsiGetSummaryInformationW(hDb, NULL, 0, &hSumInfo);
MsiCloseHandle(hDb);
if (rc == ERROR_SUCCESS)

View File

@ -190,6 +190,8 @@ UINT WINAPI MsiOpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIHANDLE *phD
if( ret == ERROR_SUCCESS )
{
*phDB = alloc_msihandle( &db->hdr );
if (! *phDB)
ret = ERROR_NOT_ENOUGH_MEMORY;
msiobj_release( &db->hdr );
}

View File

@ -124,6 +124,8 @@ UINT WINAPI MsiOpenProductW( LPCWSTR szProduct, MSIHANDLE *phProduct )
if( r == ERROR_SUCCESS )
{
*phProduct = alloc_msihandle( &package->hdr );
if (! *phProduct)
r = ERROR_NOT_ENOUGH_MEMORY;
msiobj_release( &package->hdr );
}
return r;

View File

@ -254,6 +254,8 @@ UINT WINAPI MsiDatabaseOpenViewW(MSIHANDLE hdb,
if( ret == ERROR_SUCCESS )
{
*phView = alloc_msihandle( &query->hdr );
if (! *phView)
ret = ERROR_NOT_ENOUGH_MEMORY;
msiobj_release( &query->hdr );
}
msiobj_release( &db->hdr );
@ -365,6 +367,8 @@ UINT WINAPI MsiViewFetch(MSIHANDLE hView, MSIHANDLE *record)
if( ret == ERROR_SUCCESS )
{
*record = alloc_msihandle( &rec->hdr );
if (! *record)
ret = ERROR_NOT_ENOUGH_MEMORY;
msiobj_release( &rec->hdr );
}
msiobj_release( &query->hdr );
@ -532,6 +536,8 @@ UINT WINAPI MsiViewGetColumnInfo(MSIHANDLE hView, MSICOLINFO info, MSIHANDLE *hR
}
*hRec = alloc_msihandle( &rec->hdr );
if (! *hRec)
r = ERROR_NOT_ENOUGH_MEMORY;
out:
msiobj_release( &query->hdr );
@ -830,6 +836,8 @@ UINT WINAPI MsiDatabaseGetPrimaryKeysW( MSIHANDLE hdb,
if( r == ERROR_SUCCESS )
{
*phRec = alloc_msihandle( &rec->hdr );
if (! *phRec)
r = ERROR_NOT_ENOUGH_MEMORY;
msiobj_release( &rec->hdr );
}
msiobj_release( &db->hdr );

View File

@ -365,6 +365,10 @@ static UINT msi_get_word_count( MSIPACKAGE *package )
MSIHANDLE suminfo;
MSIHANDLE hdb = alloc_msihandle( &package->db->hdr );
if (!hdb) {
ERR("Unable to allocate handle\n");
return 0;
}
rc = MsiGetSummaryInformationW( hdb, NULL, 0, &suminfo );
MsiCloseHandle(hdb);
if (rc != ERROR_SUCCESS)
@ -584,6 +588,8 @@ UINT WINAPI MsiOpenPackageExW(LPCWSTR szPackage, DWORD dwOptions, MSIHANDLE *phP
if( ret == ERROR_SUCCESS )
{
*phPackage = alloc_msihandle( &package->hdr );
if (! *phPackage)
ret = ERROR_NOT_ENOUGH_MEMORY;
msiobj_release( &package->hdr );
}

View File

@ -76,6 +76,8 @@ UINT WINAPI MsiEnableUIPreview( MSIHANDLE hdb, MSIHANDLE* phPreview )
*phPreview = alloc_msihandle( &preview->hdr );
msiobj_release( &preview->hdr );
r = ERROR_SUCCESS;
if (! *phPreview)
r = ERROR_NOT_ENOUGH_MEMORY;
}
msiobj_release( &db->hdr );

View File

@ -468,6 +468,8 @@ UINT WINAPI MsiGetSummaryInformationW( MSIHANDLE hDatabase,
*pHandle = alloc_msihandle( &si->hdr );
if( *pHandle )
ret = ERROR_SUCCESS;
else
ret = ERROR_NOT_ENOUGH_MEMORY;
msiobj_release( &si->hdr );
}