[maemo-commits] [maemo-commits] r18669 - in projects/haf/trunk/libosso: debian src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Jun 9 09:05:46 EEST 2009
Author: kihamala
Date: 2009-06-09 09:05:27 +0300 (Tue, 09 Jun 2009)
New Revision: 18669

Modified:
   projects/haf/trunk/libosso/debian/changelog
   projects/haf/trunk/libosso/src/osso-display.c
   projects/haf/trunk/libosso/src/osso-hw.c
   projects/haf/trunk/libosso/src/osso-init.c
   projects/haf/trunk/libosso/src/osso-locale.c
   projects/haf/trunk/libosso/src/osso-time.c
Log:
coverity fixes


Modified: projects/haf/trunk/libosso/debian/changelog
===================================================================
--- projects/haf/trunk/libosso/debian/changelog	2009-06-08 14:43:11 UTC (rev 18668)
+++ projects/haf/trunk/libosso/debian/changelog	2009-06-09 06:05:27 UTC (rev 18669)
@@ -1,3 +1,9 @@
+libosso (2.21-1~unreleased) unstable; urgency=low
+
+  * Fixes: NB#121151 - libosso coverity findings
+
+ -- Kimmo Hämäläinen <kimmo.hamalainen at nokia.com>  Tue,  9 Jun 2009 08:48:36 +0300
+
 libosso (2.20-1) unstable; urgency=low
 
   * Fix test-hw-prog.c test program.

Modified: projects/haf/trunk/libosso/src/osso-display.c
===================================================================
--- projects/haf/trunk/libosso/src/osso-display.c	2009-06-08 14:43:11 UTC (rev 18668)
+++ projects/haf/trunk/libosso/src/osso-display.c	2009-06-09 06:05:27 UTC (rev 18669)
@@ -131,6 +131,7 @@
   if (dbus_error_is_set(&error)) {
       ULOG_ERR_F("dbus_bus_add_match() failed: %s", error.message);
       dbus_error_free(&error);
+      free(ot);
       return OSSO_ERROR;
   }
   

Modified: projects/haf/trunk/libosso/src/osso-hw.c
===================================================================
--- projects/haf/trunk/libosso/src/osso-hw.c	2009-06-08 14:43:11 UTC (rev 18668)
+++ projects/haf/trunk/libosso/src/osso-hw.c	2009-06-09 06:05:27 UTC (rev 18669)
@@ -1069,48 +1069,52 @@
 }
 
 static muali_error_t compose_match(const muali_event_info_t *info,
-                                   char **match)
+                                   char **_match)
 {
         size_t free_space = MUALI_MAX_MATCH_SIZE;
         char buf[MUALI_MAX_MATCH_SIZE + 1];
-        buf[0] = '\0';
+        char* match;
 
-        *match = malloc(MUALI_MAX_MATCH_SIZE + 1);
-        if (*match == NULL) {
+        match = malloc(MUALI_MAX_MATCH_SIZE + 1);
+        if (match == NULL) {
                 return MUALI_ERROR_OOM;
         }
         match[0] = '\0';
+        buf[0] = '\0';
 
         if (info->service != NULL) {
                 snprintf(buf, MUALI_MAX_MATCH_SIZE, "sender='%s',",
                          info->service);
-                strncat(*match, buf, free_space);
-                free_space -= strlen(*match);
+                strncat(match, buf, free_space);
+                free_space -= strlen(match);
         }
         if (info->path != NULL) {
                 snprintf(buf, MUALI_MAX_MATCH_SIZE, "path='%s',", info->path);
-                strncat(*match, buf, free_space);
-                free_space -= strlen(*match);
+                strncat(match, buf, free_space);
+                free_space -= strlen(match);
         }
         if (info->interface != NULL) {
                 snprintf(buf, MUALI_MAX_MATCH_SIZE, "interface='%s',",
                          info->interface);
-                strncat(*match, buf, free_space);
-                free_space -= strlen(*match);
+                strncat(match, buf, free_space);
+                free_space -= strlen(match);
         }
         if (info->name != NULL) {
                 snprintf(buf, MUALI_MAX_MATCH_SIZE, "member='%s',",
                          info->name);
-                strncat(*match, buf, free_space);
-                free_space -= strlen(*match);
+                strncat(match, buf, free_space);
+                free_space -= strlen(match);
         }
         if (free_space < MUALI_MAX_MATCH_SIZE) {
                 /* remove the last comma */
-                match[strlen(*match) - 1] = '\0';
+                int n = strlen(match);
+                match[n - 1] = '\0';
         } else {
-                free(*match);
-                *match = NULL;
+                free(match);
+                match = NULL;
         }
+	/* Save generated match to out parameter */
+	*_match = match;
         return MUALI_ERROR_SUCCESS;
 }
 

Modified: projects/haf/trunk/libosso/src/osso-init.c
===================================================================
--- projects/haf/trunk/libosso/src/osso-init.c	2009-06-08 14:43:11 UTC (rev 18668)
+++ projects/haf/trunk/libosso/src/osso-init.c	2009-06-09 06:05:27 UTC (rev 18669)
@@ -619,7 +619,7 @@
         dbus_connection_remove_filter(conn, _muali_filter_session, osso);
         dbus_connection_remove_filter(conn, _muali_filter_system, osso);
     }
-    if (osso->service != NULL)
+    if (osso->service[0])
         dbus_bus_release_name(conn, osso->service, NULL);
 #ifdef LIBOSSO_DEBUG
     dbus_connection_remove_filter(conn, _debug_filter, NULL);

Modified: projects/haf/trunk/libosso/src/osso-locale.c
===================================================================
--- projects/haf/trunk/libosso/src/osso-locale.c	2009-06-08 14:43:11 UTC (rev 18668)
+++ projects/haf/trunk/libosso/src/osso-locale.c	2009-06-09 06:05:27 UTC (rev 18669)
@@ -63,6 +63,7 @@
   if (dbus_error_is_set(&error)) {
       ULOG_ERR_F("dbus_bus_add_match() failed: %s", error.message);
       dbus_error_free(&error);
+      free(ot);
       return OSSO_ERROR;
   }
   

Modified: projects/haf/trunk/libosso/src/osso-time.c
===================================================================
--- projects/haf/trunk/libosso/src/osso-time.c	2009-06-08 14:43:11 UTC (rev 18668)
+++ projects/haf/trunk/libosso/src/osso-time.c	2009-06-09 06:05:27 UTC (rev 18669)
@@ -72,6 +72,7 @@
   if (dbus_error_is_set(&error)) {
       ULOG_ERR_F("dbus_bus_add_match() failed: %s", error.message);
       dbus_error_free(&error);
+      free(ot);
       return OSSO_ERROR;
   }
   


More information about the maemo-commits mailing list