James Hawkins : msi: Free the column info data when updating the table column info.

Alexandre Julliard julliard at winehq.org
Tue Dec 8 11:10:37 CST 2009


Module: wine
Branch: master
Commit: b13803ea40ec15d39540694d45b431ce31b46463
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b13803ea40ec15d39540694d45b431ce31b46463

Author: James Hawkins <truiken at gmail.com>
Date:   Mon Dec  7 19:55:21 2009 -0800

msi: Free the column info data when updating the table column info.

---

 dlls/msi/table.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/dlls/msi/table.c b/dlls/msi/table.c
index a0317da..d2b9a00 100644
--- a/dlls/msi/table.c
+++ b/dlls/msi/table.c
@@ -1042,17 +1042,22 @@ static UINT get_tablecolumns( MSIDATABASE *db,
 static void msi_update_table_columns( MSIDATABASE *db, LPCWSTR name )
 {
     MSITABLE *table;
+    LPWSTR tablename;
     UINT size, offset, old_count;
     UINT n;
 
-    table = find_cached_table( db, name );
+    /* We may free name in msi_free_colinfo. */
+    tablename = strdupW( name );
+
+    table = find_cached_table( db, tablename );
     old_count = table->col_count;
+    msi_free_colinfo( table->colinfo, table->col_count );
     msi_free( table->colinfo );
     table->colinfo = NULL;
 
-    table_get_column_info( db, name, &table->colinfo, &table->col_count );
+    table_get_column_info( db, tablename, &table->colinfo, &table->col_count );
     if (!table->col_count)
-        return;
+        goto done;
 
     size = msi_table_get_row_size( db, table->colinfo, table->col_count );
     offset = table->colinfo[table->col_count - 1].offset;
@@ -1063,6 +1068,9 @@ static void msi_update_table_columns( MSIDATABASE *db, LPCWSTR name )
         if (old_count < table->col_count)
             memset( &table->data[n][offset], 0, size - offset );
     }
+
+done:
+    msi_free(tablename);
 }
 
 /* try to find the table name in the _Tables table */




More information about the wine-cvs mailing list