msi: Don't update the table columns if there are no more columns.

This should fix the heap corruption that caused intermittent crashes
for patchwatcher.
This commit is contained in:
James Hawkins 2008-10-07 01:52:00 -05:00 committed by Alexandre Julliard
parent 7cd6736886
commit e88b09a342
1 changed files with 5 additions and 1 deletions

View File

@ -585,6 +585,8 @@ static UINT table_get_column_info( MSIDATABASE *db, LPCWSTR name, MSICOLUMNINFO
if( r != ERROR_SUCCESS ) if( r != ERROR_SUCCESS )
return r; return r;
*pcount = column_count;
/* if there's no columns, there's no table */ /* if there's no columns, there's no table */
if( column_count == 0 ) if( column_count == 0 )
return ERROR_INVALID_PARAMETER; return ERROR_INVALID_PARAMETER;
@ -603,7 +605,6 @@ static UINT table_get_column_info( MSIDATABASE *db, LPCWSTR name, MSICOLUMNINFO
} }
*pcols = columns; *pcols = columns;
*pcount = column_count;
return r; return r;
} }
@ -1034,6 +1035,9 @@ static void msi_update_table_columns( MSIDATABASE *db, LPCWSTR name )
msi_free( table->colinfo ); msi_free( table->colinfo );
table_get_column_info( db, name, &table->colinfo, &table->col_count ); table_get_column_info( db, name, &table->colinfo, &table->col_count );
if (!table->col_count)
return;
size = msi_table_get_row_size( db, table->colinfo, table->col_count ); size = msi_table_get_row_size( db, table->colinfo, table->col_count );
offset = table->colinfo[table->col_count - 1].offset; offset = table->colinfo[table->col_count - 1].offset;