Hans Leidekker : msi: Avoid zero size allocations (Valgrind).
Alexandre Julliard
julliard at winehq.org
Fri Oct 20 07:19:59 CDT 2017
Module: wine
Branch: stable
Commit: 3736b7dbce3ba0e3ff1dec03d8e271e2124a1cf6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3736b7dbce3ba0e3ff1dec03d8e271e2124a1cf6
Author: Hans Leidekker <hans at codeweavers.com>
Date: Tue Mar 28 10:45:56 2017 +0200
msi: Avoid zero size allocations (Valgrind).
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit d12728a872b03a537ee6d92789fb6cbd2d86ba1d)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
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 );
More information about the wine-cvs
mailing list