diff --git a/dlls/msi/action.c b/dlls/msi/action.c index ce47d3134f4..da7d7e8ddcc 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -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) diff --git a/dlls/msi/database.c b/dlls/msi/database.c index 0dc3f858d29..609db238988 100644 --- a/dlls/msi/database.c +++ b/dlls/msi/database.c @@ -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 ); } diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c index 7b100a158fd..d15f222024d 100644 --- a/dlls/msi/msi.c +++ b/dlls/msi/msi.c @@ -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; diff --git a/dlls/msi/msiquery.c b/dlls/msi/msiquery.c index 06c6bf98622..27d93f61a7b 100644 --- a/dlls/msi/msiquery.c +++ b/dlls/msi/msiquery.c @@ -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 ); diff --git a/dlls/msi/package.c b/dlls/msi/package.c index 5a229570432..871ccbf268a 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -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 ); } diff --git a/dlls/msi/preview.c b/dlls/msi/preview.c index 7ee6c22a4cf..161bcc75f51 100644 --- a/dlls/msi/preview.c +++ b/dlls/msi/preview.c @@ -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 ); diff --git a/dlls/msi/suminfo.c b/dlls/msi/suminfo.c index 6e07a3ae835..7b547521d58 100644 --- a/dlls/msi/suminfo.c +++ b/dlls/msi/suminfo.c @@ -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 ); }