msi: fix missing alloc check.

Lionel Debroux lionel_debroux at yahoo.fr
Sun Dec 9 04:58:46 CST 2007


---
 dlls/msi/dialog.c |   75 +++++++++++++++++++++++++++-------------------------
 1 files changed, 39 insertions(+), 36 deletions(-)

diff --git a/dlls/msi/dialog.c b/dlls/msi/dialog.c
index d0e91cd..871d7b2 100644
--- a/dlls/msi/dialog.c
+++ b/dlls/msi/dialog.c
@@ -409,46 +409,49 @@ static msi_control *msi_dialog_create_window( msi_dialog *dialog,
     style |= WS_CHILD;
 
     control = msi_alloc( sizeof *control + strlenW(name)*sizeof(WCHAR) );
-    strcpyW( control->name, name );
-    list_add_head( &dialog->controls, &control->entry );
-    control->handler = NULL;
-    control->property = NULL;
-    control->value = NULL;
-    control->hBitmap = NULL;
-    control->hIcon = NULL;
-    control->hDll = NULL;
-    control->tabnext = strdupW( MSI_RecordGetString( rec, 11) );
-    control->type = strdupW( MSI_RecordGetString( rec, 3 ) );
-    control->progress_current = 0;
-    control->progress_max = 100;
-
-    x = MSI_RecordGetInteger( rec, 4 );
-    y = MSI_RecordGetInteger( rec, 5 );
-    width = MSI_RecordGetInteger( rec, 6 );
-    height = MSI_RecordGetInteger( rec, 7 );
-
-    x = msi_dialog_scale_unit( dialog, x );
-    y = msi_dialog_scale_unit( dialog, y );
-    width = msi_dialog_scale_unit( dialog, width );
-    height = msi_dialog_scale_unit( dialog, height );
-
-    if( text )
-    {
-        deformat_string( dialog->package, text, &title_font );
-        font = msi_dialog_get_style( title_font, &title );
-    }
+    if (control)
+    {
+        strcpyW( control->name, name );
+        list_add_head( &dialog->controls, &control->entry );
+        control->handler = NULL;
+        control->property = NULL;
+        control->value = NULL;
+        control->hBitmap = NULL;
+        control->hIcon = NULL;
+        control->hDll = NULL;
+        control->tabnext = strdupW( MSI_RecordGetString( rec, 11) );
+        control->type = strdupW( MSI_RecordGetString( rec, 3 ) );
+        control->progress_current = 0;
+        control->progress_max = 100;
+
+        x = MSI_RecordGetInteger( rec, 4 );
+        y = MSI_RecordGetInteger( rec, 5 );
+        width = MSI_RecordGetInteger( rec, 6 );
+        height = MSI_RecordGetInteger( rec, 7 );
+
+        x = msi_dialog_scale_unit( dialog, x );
+        y = msi_dialog_scale_unit( dialog, y );
+        width = msi_dialog_scale_unit( dialog, width );
+        height = msi_dialog_scale_unit( dialog, height );
+
+        if( text )
+        {
+            deformat_string( dialog->package, text, &title_font );
+            font = msi_dialog_get_style( title_font, &title );
+        }
 
-    control->hwnd = CreateWindowExW( exstyle, szCls, title, style,
-                          x, y, width, height, parent, NULL, NULL, NULL );
+        control->hwnd = CreateWindowExW( exstyle, szCls, title, style,
+                              x, y, width, height, parent, NULL, NULL, NULL );
 
-    TRACE("Dialog %s control %s hwnd %p\n",
-           debugstr_w(dialog->name), debugstr_w(text), control->hwnd );
+        TRACE("Dialog %s control %s hwnd %p\n",
+               debugstr_w(dialog->name), debugstr_w(text), control->hwnd );
 
-    msi_dialog_set_font( dialog, control->hwnd,
-                         font ? font : dialog->default_font );
+        msi_dialog_set_font( dialog, control->hwnd,
+                             font ? font : dialog->default_font );
 
-    msi_free( title_font );
-    msi_free( font );
+        msi_free( title_font );
+        msi_free( font );
+    }
 
     return control;
 }
-- 
1.5.3.4


--------------060408090500040007030204--



More information about the wine-patches mailing list