msi: remove limit on number of handles (take 3)
Alexandre Julliard
julliard at winehq.org
Thu Aug 24 05:38:55 CDT 2006
"Dan Kegel" <dank at kegel.com> writes:
> @@ -66,18 +67,29 @@ MSIHANDLE alloc_msihandle( MSIOBJECTHDR
>
> EnterCriticalSection( &MSI_handle_cs );
>
> + if (msihandletable == NULL)
> + {
> + msihandletable_size = 256;
> + msihandletable = msi_alloc_zero(
> + msihandletable_size*sizeof(msi_handle_info));
> + }
> +
> /* find a slot */
> - for(i=0; i<MSIMAXHANDLES; i++)
> + for(i=0; i<msihandletable_size; i++)
> if( !msihandletable[i].obj )
> break;
> - if( (i>=MSIMAXHANDLES) || msihandletable[i].obj )
> - goto out;
> + if( i==msihandletable_size )
> + {
> + msihandletable_size *= 2;
> + msihandletable = msi_realloc_zero(msihandletable,
> + msihandletable_size*sizeof(msi_handle_info));
> + }
You should check for allocation failures and fail gracefully instead
of crashing.
--
Alexandre Julliard
julliard at winehq.org
More information about the wine-devel
mailing list