Commit 0653409e authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

msi: Fix double free on error paths in TransformView_Create (scan-build).

If TransformView_Create returns an error, it should not return a pointer that table_load_transform will try to free.
parent 4db2ffa6
...@@ -2779,7 +2779,7 @@ static UINT TransformView_Create( MSIDATABASE *db, string_table *st, LPCWSTR nam ...@@ -2779,7 +2779,7 @@ static UINT TransformView_Create( MSIDATABASE *db, string_table *st, LPCWSTR nam
name_len = wcslen( name ); name_len = wcslen( name );
r = TABLE_CreateView( db, name, view ); r = TABLE_CreateView( db, name, (MSIVIEW **)&tv );
if (r == ERROR_INVALID_PARAMETER) if (r == ERROR_INVALID_PARAMETER)
{ {
/* table does not exist */ /* table does not exist */
...@@ -2790,16 +2790,11 @@ static UINT TransformView_Create( MSIDATABASE *db, string_table *st, LPCWSTR nam ...@@ -2790,16 +2790,11 @@ static UINT TransformView_Create( MSIDATABASE *db, string_table *st, LPCWSTR nam
tv->db = db; tv->db = db;
memcpy( tv->name, name, name_len * sizeof(WCHAR) ); memcpy( tv->name, name, name_len * sizeof(WCHAR) );
*view = (MSIVIEW*)tv;
} }
else if (r != ERROR_SUCCESS) else if (r != ERROR_SUCCESS)
{ {
return r; return r;
} }
else
{
tv = (struct table_view *)*view;
}
tv->view.ops = &transform_view_ops; tv->view.ops = &transform_view_ops;
...@@ -2847,6 +2842,7 @@ static UINT TransformView_Create( MSIDATABASE *db, string_table *st, LPCWSTR nam ...@@ -2847,6 +2842,7 @@ static UINT TransformView_Create( MSIDATABASE *db, string_table *st, LPCWSTR nam
{ {
MSI_ViewClose( q ); MSI_ViewClose( q );
msiobj_release( &q->hdr ); msiobj_release( &q->hdr );
*view = (MSIVIEW *)tv;
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -2883,6 +2879,7 @@ static UINT TransformView_Create( MSIDATABASE *db, string_table *st, LPCWSTR nam ...@@ -2883,6 +2879,7 @@ static UINT TransformView_Create( MSIDATABASE *db, string_table *st, LPCWSTR nam
memcpy( colinfo, tv->columns, tv->num_cols * sizeof(*colinfo) ); memcpy( colinfo, tv->columns, tv->num_cols * sizeof(*colinfo) );
tv->columns = colinfo; tv->columns = colinfo;
tv->num_cols += add_col; tv->num_cols += add_col;
*view = (MSIVIEW *)tv;
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
......
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