[maemo-commits] [maemo-commits] r17400 - in projects/haf/trunk/libmatchbox2: . debian matchbox/client-types matchbox/comp-mgr matchbox/core matchbox/theme-engines

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu Feb 12 10:25:09 EET 2009
Author: kihamala
Date: 2009-02-12 10:25:06 +0200 (Thu, 12 Feb 2009)
New Revision: 17400

Modified:
   projects/haf/trunk/libmatchbox2/ChangeLog
   projects/haf/trunk/libmatchbox2/debian/changelog
   projects/haf/trunk/libmatchbox2/matchbox/client-types/mb-wm-client-app.c
   projects/haf/trunk/libmatchbox2/matchbox/client-types/mb-wm-client-desktop.c
   projects/haf/trunk/libmatchbox2/matchbox/comp-mgr/mb-wm-comp-mgr-clutter.c
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.c
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-decor.c
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-keys.c
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-main-context.c
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-object.c
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-root-window.c
   projects/haf/trunk/libmatchbox2/matchbox/theme-engines/mb-wm-theme-png.c
   projects/haf/trunk/libmatchbox2/matchbox/theme-engines/mb-wm-theme.c
Log:
fixed several Coverity-found issues


Modified: projects/haf/trunk/libmatchbox2/ChangeLog
===================================================================
--- projects/haf/trunk/libmatchbox2/ChangeLog	2009-02-11 10:56:59 UTC (rev 17399)
+++ projects/haf/trunk/libmatchbox2/ChangeLog	2009-02-12 08:25:06 UTC (rev 17400)
@@ -1,3 +1,40 @@
+2009-02-12  Kimmo Hämäläinen  <kimmo.hamalainen at nokia.com>
+
+	Fixes for Coverity issues:
+	* matchbox/client-types/mb-wm-client-desktop.c
+	(mb_wm_client_desktop_init): Remove unused return value.
+	* matchbox/client-types/mb-wm-client-app.c (mb_wm_client_app_init):
+	Remove unused return value.
+	* matchbox/comp-mgr/mb-wm-comp-mgr-clutter.c
+	(mb_wm_comp_mgr_clutter_turn_off_real): NULL-check 'mgr' before (not
+	after) dereferencing it.
+	(mb_wm_comp_mgr_clutter_client_configure_real): Remove useless check
+	for window.
+	(tidy_texture_frame_class_init): Remove unused return value.
+	* matchbox/core/mb-wm-root-window.c (mb_wm_root_window_init):
+	NULL-check 'wm' before using it.
+	* matchbox/core/mb-wm-main-context.c
+	(mb_wm_main_context_x_event_handler_add): Free 'func_info' in Expose
+	and default case.
+	(mb_wm_main_context_x_event_handler_remove): NULL-check l_start before
+	using it.
+	* matchbox/core/mb-wm-decor.c (mb_wm_decor_init): Add a missing break.
+	(mb_wm_decor_button_stock_new): NULL-check decor->parent_client before
+	(not after) using it.
+	* matchbox/core/mb-window-manager.c (mb_wm_focus_client): White space
+	fixes to make the if condition more readable.
+	* matchbox/core/mb-wm-object.c (mb_wm_object_init_recurse): Free
+	'vap2' also in the error cases.
+	(mb_wm_object_init_object): Ditto.
+	(mb_wm_object_new): Free 'vap' in an error case.
+	* matchbox/core/mb-wm-keys.c (mb_wm_client_init): NULL-check 'wm'
+	before using it.
+	* matchbox/theme-engines/mb-wm-theme.c (mb_wm_theme_set_left_padding):
+	Check the result of both calls to mb_wm_xml_client_find_by_type().
+	(xml_element_start_cb): Free c, d, and b in the error cases.
+	* matchbox/theme-engines/mb-wm-theme-png.c (mb_wm_theme_png_ximg):
+	Free 'png_data' in the error case.
+
 2009-02-10  Kimmo Hämäläinen  <kimmo.hamalainen at nokia.com>
 
 	Release 0.2.16

Modified: projects/haf/trunk/libmatchbox2/debian/changelog
===================================================================
--- projects/haf/trunk/libmatchbox2/debian/changelog	2009-02-11 10:56:59 UTC (rev 17399)
+++ projects/haf/trunk/libmatchbox2/debian/changelog	2009-02-12 08:25:06 UTC (rev 17400)
@@ -1,6 +1,6 @@
 matchbox-window-manager-2 (0.2.17-1~unreleased) unstable; urgency=low
 
-  * unreleased
+  * Fixes for several Coverity-found issues.
 
  -- Kimmo Hämäläinen <kimmo.hamalainen at nokia.com>  Wed, 11 Feb 2009 09:25:48 +0200
 

Modified: projects/haf/trunk/libmatchbox2/matchbox/client-types/mb-wm-client-app.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/client-types/mb-wm-client-app.c	2009-02-11 10:56:59 UTC (rev 17399)
+++ projects/haf/trunk/libmatchbox2/matchbox/client-types/mb-wm-client-app.c	2009-02-12 08:25:06 UTC (rev 17400)
@@ -43,10 +43,7 @@
 {
   MBWindowManagerClient    *client     = MB_WM_CLIENT (this);
   MBWindowManager          *wm = NULL;
-  MBWMClientAppClass       *app_class;
 
-  app_class = MB_WM_CLIENT_APP_CLASS (MB_WM_OBJECT_GET_CLASS (this));
-
 #if 0
   /*
    * Property parsing not needed for now, as there are no ClientApp specific

Modified: projects/haf/trunk/libmatchbox2/matchbox/client-types/mb-wm-client-desktop.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/client-types/mb-wm-client-desktop.c	2009-02-11 10:56:59 UTC (rev 17399)
+++ projects/haf/trunk/libmatchbox2/matchbox/client-types/mb-wm-client-desktop.c	2009-02-12 08:25:06 UTC (rev 17400)
@@ -43,11 +43,8 @@
 {
   MBWindowManagerClient    *client         = MB_WM_CLIENT (this);
   MBWindowManager          *wm = NULL;
-  MBWMClientDesktopClass   *inp_class;
   MBGeometry                geom;
 
-  inp_class = MB_WM_CLIENT_DESKTOP_CLASS (MB_WM_OBJECT_GET_CLASS (this));
-
   wm = client->wmref;
 
   if (!wm)

Modified: projects/haf/trunk/libmatchbox2/matchbox/comp-mgr/mb-wm-comp-mgr-clutter.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/comp-mgr/mb-wm-comp-mgr-clutter.c	2009-02-11 10:56:59 UTC (rev 17399)
+++ projects/haf/trunk/libmatchbox2/matchbox/comp-mgr/mb-wm-comp-mgr-clutter.c	2009-02-12 08:25:06 UTC (rev 17400)
@@ -526,12 +526,13 @@
 static void
 mb_wm_comp_mgr_clutter_turn_off_real (MBWMCompMgr *mgr)
 {
-  MBWindowManager            * wm = mgr->wm;
-  MBWMCompMgrClutterPrivate  * priv;
+  MBWindowManager            *wm;
+  MBWMCompMgrClutterPrivate  *priv;
 
   if (!mgr)
     return;
 
+  wm = mgr->wm;
   priv = MB_WM_COMP_MGR_CLUTTER (mgr)->priv;
 
   if (mgr->disabled)
@@ -706,7 +707,7 @@
 
       /* FIXME xmas fix -- ignore the invisible systemui dialog, because it
        * would show as white window for some reason */
-      if (!(ctype == MBWMClientTypeMenu && wm_client->window &&
+      if (!(ctype == MBWMClientTypeMenu &&
           g_strcmp0 ("systemui", wm_client->window->name) == 0))
         {
           mb_wm_comp_mgr_clutter_fetch_texture (client);
@@ -1454,8 +1455,6 @@
 static void
 tidy_texture_frame_init (TidyTextureFrame *self)
 {
-  TidyTextureFramePrivate *priv;
-
-  self->priv = priv = TIDY_TEXTURE_FRAME_GET_PRIVATE (self);
+  self->priv = TIDY_TEXTURE_FRAME_GET_PRIVATE (self);
 }
 

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c	2009-02-11 10:56:59 UTC (rev 17399)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-window-manager.c	2009-02-12 08:25:06 UTC (rev 17400)
@@ -1991,8 +1991,11 @@
 
   if (wm->focused_client == client ||
       !mb_wm_client_want_focus (client) ||
-      (has_modal_focused_client && client == mb_wm_client_get_transient_for (wm->focused_client)) ||
-      (system_modal_focused_client && !client_is_system_modal && wm->focused_client != mb_wm_client_get_transient_for (client)))
+      (has_modal_focused_client &&
+       client == mb_wm_client_get_transient_for (wm->focused_client)) ||
+      (system_modal_focused_client &&
+       !client_is_system_modal &&
+       wm->focused_client != mb_wm_client_get_transient_for (client)))
     return False;
 
   if (!mb_wm_client_is_realized (client))

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.c	2009-02-11 10:56:59 UTC (rev 17399)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client.c	2009-02-12 08:25:06 UTC (rev 17400)
@@ -144,6 +144,9 @@
       prop = va_arg(vap, MBWMObjectProp);
     }
 
+  if (!wm)
+    return 0;
+
   MBWM_MARK();
 
   client = MB_WM_CLIENT(obj);

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-decor.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-decor.c	2009-02-11 10:56:59 UTC (rev 17399)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-decor.c	2009-02-12 08:25:06 UTC (rev 17400)
@@ -61,6 +61,7 @@
 	  break;
 	case MBWMObjectPropDecorAbsolutePacking:
 	  abs_packing = va_arg(vap, int);
+          break;
 	default:
 	  MBWMO_PROP_EAT (vap, prop);
 	}
@@ -1233,12 +1234,13 @@
 void
 mb_wm_decor_button_handle_repaint (MBWMDecorButton *button)
 {
-  MBWMDecor * decor = button->decor;
-  MBWMTheme * theme = decor->parent_client->wmref->theme;
+  MBWMDecor *decor = button->decor;
+  MBWMTheme *theme;
 
   if (decor->parent_client == NULL)
     return;
 
+  theme = decor->parent_client->wmref->theme;
   mb_wm_theme_paint_button (theme, button);
 }
 

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-keys.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-keys.c	2009-02-11 10:56:59 UTC (rev 17399)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-keys.c	2009-02-12 08:25:06 UTC (rev 17400)
@@ -323,6 +323,8 @@
   MBWMKeys        *keys;
 
   mod_map = XGetModifierMapping(wm->xdpy);
+  if (!mod_map)
+    return False;
 
   keys = wm->keys = mb_wm_util_malloc0(sizeof(MBWMKeys));
 

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-main-context.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-main-context.c	2009-02-11 10:56:59 UTC (rev 17399)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-main-context.c	2009-02-12 08:25:06 UTC (rev 17400)
@@ -634,6 +634,7 @@
   switch (type)
     {
     case Expose:
+      free (func_info);
       break;
     case MapRequest:
       ctx->event_funcs.map_request =
@@ -685,6 +686,7 @@
       break;
 
     default:
+      free (func_info);
       break;
     }
 
@@ -753,7 +755,8 @@
       break;
     }
 
-  l = *l_start;
+  if (l_start)
+    l = *l_start;
 
   while (l)
     {

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-object.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-object.c	2009-02-11 10:56:59 UTC (rev 17399)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-object.c	2009-02-12 08:25:06 UTC (rev 17400)
@@ -226,11 +226,17 @@
 
   if (parent->parent)
     if (!mb_wm_object_init_recurse (obj, parent->parent, vap2))
-      return 0;
+      {
+        va_end (vap2);
+        return 0;
+      }
 
   if (parent->init)
     if (!parent->init (obj, vap))
-      return 0;
+      {
+        va_end (vap2);
+        return 0;
+      }
 
   va_end (vap2);
 
@@ -246,11 +252,17 @@
 
   if (obj->klass->parent)
     if (!mb_wm_object_init_recurse (obj, obj->klass->parent, vap2))
-      return 0;
+      {
+        va_end(vap2);
+        return 0;
+      }
 
   if (obj->klass->init)
     if (!obj->klass->init(obj, vap))
-      return 0;
+      {
+        va_end(vap2);
+        return 0;
+      }
 
   va_end(vap2);
 
@@ -276,6 +288,7 @@
   if (!mb_wm_object_init_object (obj, vap))
     {
       free (obj);
+      va_end(vap);
       return NULL;
     }
 

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-root-window.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-root-window.c	2009-02-11 10:56:59 UTC (rev 17399)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-root-window.c	2009-02-12 08:25:06 UTC (rev 17400)
@@ -73,6 +73,12 @@
       prop = va_arg(vap, MBWMObjectProp);
     }
 
+  if (!wm)
+    {
+      MBWM_DBG ("Failed to initialize root window attributes.");
+      abort ();
+    }
+
   root_window->wm = wm;
   root_window->xwindow = RootWindow(wm->xdpy, wm->xscreen);
 

Modified: projects/haf/trunk/libmatchbox2/matchbox/theme-engines/mb-wm-theme-png.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/theme-engines/mb-wm-theme-png.c	2009-02-11 10:56:59 UTC (rev 17399)
+++ projects/haf/trunk/libmatchbox2/matchbox/theme-engines/mb-wm-theme-png.c	2009-02-12 08:25:06 UTC (rev 17400)
@@ -1292,7 +1292,10 @@
   Bool shaped = MB_WM_THEME (theme)->shaped;
 
   if (!png_data || !width || !height)
-    return 0;
+    {
+      free (png_data);
+      return 0;
+    }
 
   ren_fmt = XRenderFindStandardFormat(dpy, PictStandardARGB32);
 

Modified: projects/haf/trunk/libmatchbox2/matchbox/theme-engines/mb-wm-theme.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/theme-engines/mb-wm-theme.c	2009-02-11 10:56:59 UTC (rev 17399)
+++ projects/haf/trunk/libmatchbox2/matchbox/theme-engines/mb-wm-theme.c	2009-02-12 08:25:06 UTC (rev 17400)
@@ -669,11 +669,15 @@
 {
   MBWMThemeClass *klass = MB_WM_THEME_CLASS(MB_WM_OBJECT_GET_CLASS (theme));
   MBWMClientType c_type = MB_WM_CLIENT_CLIENT_TYPE (client);
-  MBWMDecor *decor = (MBWMDecor *)mb_wm_xml_decor_find_by_type
-        (mb_wm_xml_client_find_by_type (theme->xml_clients, c_type)->decors,
-         MBWMDecorTypeNorth);
+  MBWMDecor *decor = NULL, *decor_tmp;
+ 
+  decor_tmp = (MBWMDecor *)mb_wm_xml_client_find_by_type (theme->xml_clients,
+                                                          c_type);
+  if (decor_tmp)
+    decor = (MBWMDecor *)mb_wm_xml_decor_find_by_type (decor_tmp->decors,
+                                                       MBWMDecorTypeNorth);
 
-  if (klass->set_left_padding)
+  if (decor && klass->set_left_padding)
     klass->set_left_padding (theme, decor, new_padding);
 }
 
@@ -1010,6 +1014,7 @@
       if (ctx != XML_CTX_THEME)
 	{
 	  MBWM_DBG ("Expected context theme");
+          free (c);
 	  return;
 	}
 
@@ -1161,6 +1166,7 @@
       if (ctx != XML_CTX_CLIENT || !c)
 	{
 	  MBWM_DBG ("Expected context client");
+          free (d);
 	  return;
 	}
 
@@ -1264,6 +1270,7 @@
       if (ctx != XML_CTX_DECOR || !d)
 	{
 	  MBWM_DBG ("Expected context decor");
+          free (b);
 	  return;
 	}
 


More information about the maemo-commits mailing list