msi: Avoid zero size allocations (Valgrind).
Hans Leidekker
hans at codeweavers.com
Tue Mar 28 03:45:56 CDT 2017
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
dlls/msi/table.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/dlls/msi/table.c b/dlls/msi/table.c
index 2b36091..b364d97 100644
--- a/dlls/msi/table.c
+++ b/dlls/msi/table.c
@@ -422,13 +422,11 @@ static UINT read_table_from_storage( MSIDATABASE *db, MSITABLE *t, IStorage *stg
goto err;
}
- t->row_count = rawsize / row_size;
- t->data = msi_alloc_zero( t->row_count * sizeof (USHORT*) );
- if( !t->data )
- goto err;
- t->data_persistent = msi_alloc_zero( t->row_count * sizeof(BOOL));
- if ( !t->data_persistent )
- goto err;
+ if ((t->row_count = rawsize / row_size))
+ {
+ if (!(t->data = msi_alloc_zero( t->row_count * sizeof(USHORT *) ))) goto err;
+ if (!(t->data_persistent = msi_alloc_zero( t->row_count * sizeof(BOOL) ))) goto err;
+ }
/* transpose all the data */
TRACE("Transposing data from %d rows\n", t->row_count );
--
2.1.4
More information about the wine-patches
mailing list