From: Yunmi Ha Date: Thu, 16 Jun 2016 05:22:29 +0000 (+0900) Subject: Fix static-analyze issues (adding validation code) X-Git-Tag: accepted/tizen/common/20160617.121517^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=056ab97c513eb203199aba868ae9db33de520a6e;p=platform%2Fupstream%2Fgumd.git Fix static-analyze issues (adding validation code) gumd-dbus-server-p2p.c: fix bug - compare operation was incorrect. gumd-dbus-server-msg-bus.c: Add null check logic. gum-crypt.c: Add initialize code. Signed-off-by: Yunmi Ha Change-Id: I5aec55c14b9312c42451f94ed996435af5bedc52 --- diff --git a/src/common/gum-crypt.c b/src/common/gum-crypt.c old mode 100644 new mode 100755 index 13e8e8b..9a72145 --- a/src/common/gum-crypt.c +++ b/src/common/gum-crypt.c @@ -65,7 +65,7 @@ _generate_salt ( const gchar *encryp_algo) { ssize_t bytes_read = 0; - gchar salt[SALT_ARRAY_LEN]; + gchar salt[SALT_ARRAY_LEN] = {0,}; int fd = 0; gint id_len = METHODID_LEN, i = 0; diff --git a/src/daemon/dbus/gumd-dbus-server-msg-bus.c b/src/daemon/dbus/gumd-dbus-server-msg-bus.c old mode 100644 new mode 100755 index 49e0758..0ba0e8f --- a/src/daemon/dbus/gumd-dbus-server-msg-bus.c +++ b/src/daemon/dbus/gumd-dbus-server-msg-bus.c @@ -344,8 +344,10 @@ _gumd_dbus_server_msg_bus_get_remote_pid ( connection = g_bus_get_sync (GUM_BUS_TYPE, NULL, &error); if (!connection) { - WARN ("Failed to open connection to msg bus: %s", error->message); - g_error_free (error); + if (error) { + WARN ("Failed to open connection to msg bus: %s", error->message); + g_error_free (error); + } return remote_pid; } @@ -359,8 +361,10 @@ _gumd_dbus_server_msg_bus_get_remote_pid ( g_object_unref (connection); if (!response) { - WARN ("Request for msg-bus peer pid failed: %s", error->message); - g_error_free (error); + if (error) { + WARN ("Request for msg-bus peer pid failed: %s", error->message); + g_error_free (error); + } return remote_pid; } diff --git a/src/daemon/dbus/gumd-dbus-server-p2p.c b/src/daemon/dbus/gumd-dbus-server-p2p.c index ad386c7..00f8d68 100755 --- a/src/daemon/dbus/gumd-dbus-server-p2p.c +++ b/src/daemon/dbus/gumd-dbus-server-p2p.c @@ -468,7 +468,7 @@ const gchar * gumd_dbus_server_p2p_get_address ( GumdDbusServerP2P *server) { - g_return_val_if_fail (server || GUMD_IS_DBUS_SERVER_P2P (server), NULL); + g_return_val_if_fail (server && GUMD_IS_DBUS_SERVER_P2P (server), NULL); return g_dbus_server_get_client_address (server->priv->bus_server); }