Commit 0093007b authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

Track memory allocations in the SQL parser.

parent 7f99aa83
......@@ -201,20 +201,10 @@ static UINT CREATE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode,
static UINT CREATE_delete( struct tagMSIVIEW *view )
{
MSICREATEVIEW *cv = (MSICREATEVIEW*)view;
create_col_info *col;
TRACE("%p\n", cv );
col = cv->col_info;
while( col )
{
create_col_info *t = col;
col = col->next;
HeapFree( GetProcessHeap(), 0, t->colname );
HeapFree( GetProcessHeap(), 0, t );
}
msiobj_release( &cv->db->hdr );
HeapFree( GetProcessHeap(), 0, cv->name );
HeapFree( GetProcessHeap(), 0, cv );
return ERROR_SUCCESS;
......@@ -250,7 +240,7 @@ UINT CREATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR table,
cv->view.ops = &create_ops;
msiobj_addref( &db->hdr );
cv->db = db;
cv->name = table; /* FIXME: strdupW it? */
cv->name = table;
cv->col_info = col_info;
cv->bIsTemp = temp;
*view = (MSIVIEW*) cv;
......
......@@ -233,7 +233,6 @@ static UINT INSERT_delete( struct tagMSIVIEW *view )
sv = iv->sv;
if( sv )
sv->ops->delete( sv );
delete_value_list( iv->vals );
msiobj_release( &iv->db->hdr );
HeapFree( GetProcessHeap(), 0, iv );
......
......@@ -30,6 +30,7 @@
#include "objbase.h"
#include "objidl.h"
#include "wine/unicode.h"
#include "wine/list.h"
#define MSI_DATASIZEMASK 0x00ff
#define MSITYPE_VALID 0x0100
......@@ -77,6 +78,7 @@ typedef struct tagMSIQUERY
MSIVIEW *view;
UINT row;
MSIDATABASE *db;
struct list mem;
} MSIQUERY;
/* maybe we can use a Variant instead of doing it ourselves? */
......
......@@ -41,10 +41,16 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi);
void MSI_CloseView( MSIOBJECTHDR *arg )
{
MSIQUERY *query = (MSIQUERY*) arg;
struct list *ptr, *t;
if( query->view && query->view->ops->delete )
query->view->ops->delete( query->view );
msiobj_release( &query->db->hdr );
LIST_FOR_EACH_SAFE( ptr, t, &query->mem )
{
HeapFree( GetProcessHeap(), 0, ptr );
}
}
UINT VIEW_find_column( MSIVIEW *table, LPCWSTR name, UINT *n )
......@@ -120,8 +126,9 @@ UINT MSI_DatabaseOpenViewW(MSIDATABASE *db,
query->row = 0;
query->db = db;
query->view = NULL;
list_init( &query->mem );
r = MSI_ParseSQL( db, szQuery, &query->view );
r = MSI_ParseSQL( db, szQuery, &query->view, &query->mem );
if( r == ERROR_SUCCESS )
{
msiobj_addref( &query->hdr );
......
......@@ -30,6 +30,7 @@
#include "msi.h"
#include "msiquery.h"
#include "msipriv.h"
#include "wine/list.h"
#define OP_EQ 1
......@@ -105,7 +106,8 @@ typedef struct _column_assignment
} column_assignment;
UINT MSI_ParseSQL( MSIDATABASE *db, LPCWSTR command, MSIVIEW **phView);
UINT MSI_ParseSQL( MSIDATABASE *db, LPCWSTR command, MSIVIEW **phview,
struct list *mem );
UINT TABLE_CreateView( MSIDATABASE *db, LPCWSTR name, MSIVIEW **view );
......@@ -131,10 +133,6 @@ UINT UPDATE_CreateView( MSIDATABASE *db, MSIVIEW **, LPWSTR table,
UINT DELETE_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table );
void delete_expr( struct expr *e );
void delete_string_list( string_list *sl );
void delete_value_list( value_list *vl );
int sqliteGetToken(const WCHAR *z, int *tokenType);
#endif /* __WINE_MSI_QUERY_H */
......@@ -171,7 +171,6 @@ static UINT UPDATE_delete( struct tagMSIVIEW *view )
wv = uv->wv;
if( wv )
wv->ops->delete( wv );
delete_value_list( uv->vals );
msiobj_release( &uv->db->hdr );
HeapFree( GetProcessHeap(), 0, uv );
......
......@@ -334,9 +334,6 @@ static UINT WHERE_delete( struct tagMSIVIEW *view )
wv->reorder = NULL;
wv->row_count = 0;
if( wv->cond )
delete_expr( wv->cond );
msiobj_release( &wv->db->hdr );
HeapFree( GetProcessHeap(), 0, wv );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment