Module: wine Branch: master Commit: 337e1e202f636404933cbb721366306f0d59b788 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=337e1e202f636404933cbb72...
Author: Dan Kegel dank@kegel.com Date: Mon Aug 28 09:44:35 2006 -0700
msi: Callers of alloc_msihandle should handle failure.
---
dlls/msi/action.c | 4 ++++ dlls/msi/database.c | 2 ++ dlls/msi/msi.c | 2 ++ dlls/msi/msiquery.c | 8 ++++++++ dlls/msi/package.c | 6 ++++++ dlls/msi/preview.c | 2 ++ dlls/msi/suminfo.c | 2 ++ 7 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/dlls/msi/action.c b/dlls/msi/action.c index ce47d31..da7d7e8 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -3146,6 +3146,10 @@ static UINT ACTION_PublishProduct(MSIPAC /* 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 0dc3f85..609db23 100644 --- a/dlls/msi/database.c +++ b/dlls/msi/database.c @@ -190,6 +190,8 @@ UINT WINAPI MsiOpenDatabaseW(LPCWSTR szD 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 7b100a1..d15f222 100644 --- a/dlls/msi/msi.c +++ b/dlls/msi/msi.c @@ -124,6 +124,8 @@ UINT WINAPI MsiOpenProductW( LPCWSTR szP 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 06c6bf9..27d93f6 100644 --- a/dlls/msi/msiquery.c +++ b/dlls/msi/msiquery.c @@ -254,6 +254,8 @@ UINT WINAPI MsiDatabaseOpenViewW(MSIHAND 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 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(MSIHAND }
*hRec = alloc_msihandle( &rec->hdr ); + if (! *hRec) + r = ERROR_NOT_ENOUGH_MEMORY;
out: msiobj_release( &query->hdr ); @@ -830,6 +836,8 @@ UINT WINAPI MsiDatabaseGetPrimaryKeysW( 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 5a22957..871ccbf 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -365,6 +365,10 @@ static UINT msi_get_word_count( MSIPACKA 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 sz 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 7ee6c22..161bcc7 100644 --- a/dlls/msi/preview.c +++ b/dlls/msi/preview.c @@ -76,6 +76,8 @@ UINT WINAPI MsiEnableUIPreview( MSIHANDL *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 6e07a3a..7b54752 100644 --- a/dlls/msi/suminfo.c +++ b/dlls/msi/suminfo.c @@ -468,6 +468,8 @@ UINT WINAPI MsiGetSummaryInformationW( M *pHandle = alloc_msihandle( &si->hdr ); if( *pHandle ) ret = ERROR_SUCCESS; + else + ret = ERROR_NOT_ENOUGH_MEMORY; msiobj_release( &si->hdr ); }