[gtk+] gtkmenu: Fix potential use of uninitialised variables



commit a265d8f32df414b7ccf48ca4779e020572163237
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Wed Nov 20 17:31:28 2013 +0000

    gtkmenu: Fix potential use of uninitialised variables
    
    The child_height out variable is only valid if compute_child_offset()
    returns TRUE.
    
    Found by scan-build.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=712760

 gtk/gtkmenu.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index d9cb648..43dbb28 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -5414,9 +5414,9 @@ gtk_menu_real_move_scroll (GtkMenu       *menu,
           {
             gint child_height;
 
-            compute_child_offset (menu, menu_shell->priv->active_menu_item,
-                                  &child_offset, &child_height, NULL);
-            child_offset += child_height / 2;
+            if (compute_child_offset (menu, menu_shell->priv->active_menu_item,
+                                      &child_offset, &child_height, NULL))
+              child_offset += child_height / 2;
           }
 
         menu_shell->priv->ignore_enter = TRUE;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]