MSI: Fix crash that occured when an invalid query string was deleted twice

Mike McCormack mike at codeweavers.com
Fri Jun 25 15:08:47 CDT 2004


ChangeLog:
* Fix crash that occured when an invalid query string was deleted twice
-------------- next part --------------
diff -ur dlls/msi.old/sql.y dlls/msi/sql.y
--- dlls/msi.old/sql.y	2004-06-25 15:02:15.000000000 -0500
+++ dlls/msi/sql.y	2004-06-25 15:03:13.000000000 -0500
@@ -51,7 +51,6 @@
 static LPWSTR SQL_getstring( struct sql_str *str );
 static INT SQL_getint( SQL_input *sql );
 static int SQL_lex( void *SQL_lval, SQL_input *info);
-static LPWSTR SQL_strdup( struct sql_str *str);
 
 static MSIVIEW *do_one_select( MSIDATABASE *db, MSIVIEW *in, 
                                string_list *columns );
@@ -641,16 +640,6 @@
     return view;
 }
 
-#if 0
-static LPWSTR SQL_strdup( struct sql_str *str)
-{
-    LPWSTR ret = HeapAlloc( GetProcessHeap(), 0, (str->len+1)*sizeof(WCHAR) );
-    strncpyW( ret, str->data, str->len );
-    ret[str->len]=0;
-    return ret;
-}
-#endif
-
 static struct expr * EXPR_complex( struct expr *l, UINT op, struct expr *r )
 {
     struct expr *e = HeapAlloc( GetProcessHeap(), 0, sizeof *e );
@@ -778,6 +767,7 @@
     {
         if( *sql.view )
             (*sql.view)->ops->delete( *sql.view );
+        *sql.view = NULL;
         return ERROR_BAD_QUERY_SYNTAX;
     }
 
diff -ur dlls/msi.old/table.c dlls/msi/table.c
--- dlls/msi.old/table.c	2004-06-25 15:02:15.000000000 -0500
+++ dlls/msi/table.c	2004-06-25 15:03:13.000000000 -0500
@@ -615,7 +615,7 @@
     db->strings = msi_init_stringtable( count );
 
     if( pool[0] || pool[1] )
-        ERR("The first string should be nul, but isn't\n");
+        ERR("The first string should be nul, but isn't %04x %04x\n", pool[0], pool[1]);
     offset = 0;
     for( i=1; i<count; i++ )
     {
diff -ur dlls/msi.old/where.c dlls/msi/where.c
--- dlls/msi.old/where.c	2004-06-25 15:02:15.000000000 -0500
+++ dlls/msi/where.c	2004-06-25 15:03:13.000000000 -0500
@@ -295,7 +295,8 @@
     wv->reorder = NULL;
     wv->row_count = 0;
 
-    delete_expr( wv->cond );
+    if( wv->cond )
+        delete_expr( wv->cond );
 
     HeapFree( GetProcessHeap(), 0, wv );
 
@@ -340,6 +341,7 @@
     wv->table = table;
     wv->row_count = 0;
     wv->reorder = NULL;
+    wv->cond = NULL;
     *view = (MSIVIEW*) wv;
 
     return ERROR_SUCCESS;


More information about the wine-patches mailing list