Fix issues that detected by static analysis tool 64/214564/1
authorSungwook Park <sungwook79.park@samsung.com>
Tue, 24 Sep 2019 04:53:13 +0000 (13:53 +0900)
committerSungwook Park <sungwook79.park@samsung.com>
Tue, 24 Sep 2019 04:53:13 +0000 (13:53 +0900)
Change-Id: Ib78994b2c910e05d5e19fedce613ae1cf62e21bf
Signed-off-by: Sungwook Park <sungwook79.park@samsung.com>
client/vc.c
client/vc_dbus.c
client/vc_mgr_dbus.c
client/vc_widget.c
common/vc_cmd_db.c
server/vcd_dbus.c
server/vcd_dbus_server.c

index 677713e..458ece8 100644 (file)
@@ -547,7 +547,9 @@ static Eina_Bool __vc_connect_daemon(void *data)
                ecore_thread_main_loop_end();
 
                char appid[1024] = {'\0',};
-               aul_app_get_appid_bypid(getpid(), appid, sizeof(appid) - 1);
+               ret = aul_app_get_appid_bypid(getpid(), appid, sizeof(appid) - 1);
+               if (ret != AUL_R_OK)
+                       SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get aul_app_get_appid_bypid : %d", ret);
 
                int status = aul_app_get_status(appid);
                if (STATUS_FOCUS == status) {
index 8408cbe..cb0c7b6 100644 (file)
@@ -355,6 +355,7 @@ on_name_acquired(GDBusConnection *connection,
 
        GDBusVcclient *service;
        GError *error = NULL;
+       gboolean ret = FALSE;
 
        service = gdbus_vcclient_skeleton_new();
 
@@ -370,9 +371,9 @@ on_name_acquired(GDBusConnection *connection,
        g_signal_connect(service, "handle-vcm-client-method-utterance-status",
                G_CALLBACK(vcm_client_method_utterance_status), NULL);
 
-       g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(service),
+       ret = g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(service),
        connection, VC_CLIENT_SERVICE_OBJECT_PATH, &error);
-       if (error) {
+       if (ret == FALSE || error) {
                SLOG(LOG_DEBUG, TAG_VCC, "Error : %s\n", error->message);
                g_error_free(error);
        }
index e4f39ca..f071430 100644 (file)
@@ -3244,6 +3244,7 @@ int vc_mgr_dbus_send_audio_streaming(int pid, vc_audio_streaming_event_e event,
        gdbus_vcdaemon_call_vcm_daemon_method_send_audio_streaming(g_daemon_proxy,
                        pid, event, len, variant, NULL, NULL, NULL);
 
+       g_variant_ref(variant);
        return 0;
 #else
        if (0 != __dbus_check()) {
index a40506c..950f7fc 100644 (file)
@@ -440,7 +440,9 @@ static Eina_Bool __vc_widget_connect_daemon(void *data)
 
        /* Get app focus and set foreground */
        char appid[1024] = {'\0',};
-       aul_app_get_appid_bypid(getpid(), appid, sizeof(appid) - 1);
+       ret = aul_app_get_appid_bypid(getpid(), appid, sizeof(appid) - 1);
+       if (ret != AUL_R_OK)
+               SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get aul_app_get_appid_bypid : %d", ret);
 
        int status = aul_app_get_status(appid);
        if (status == STATUS_FOCUS) {
index 37726a9..f3889d5 100644 (file)
@@ -1434,6 +1434,8 @@ static int __vc_db_create_table(sqlite3* db_handle, const char* table)
        int ret = __vc_db_exec_query(db_handle, sql);
        if (ret != VC_DB_ERROR_NONE) {
                SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] Fail to create table(%s), %d", table, ret);
+               free(sql);
+               sql = NULL;
                return VC_DB_ERROR_OPERATION_FAILED;
        }
        SLOG(LOG_WARN, vc_db_tag(), "[SQL] %s", sql);
index a61912d..853a26e 100644 (file)
@@ -1232,6 +1232,7 @@ int vcdc_send_feedback_streaming_to_manager(int manager_pid, int pid, int utt_id
                pid, utt_id, event, len, variant, NULL, NULL, NULL);
 
        g_object_unref(proxy);
+       g_variant_ref(variant);
        return 0;
 #else
        SLOG(LOG_INFO, TAG_VCD, "[Dbus] Send TTS feedback streaming : manager_pid(%d), pid(%d), utt_id(%d) feedback event(%d), buffer(%p), length(%d)", manager_pid, pid, utt_id, event, buffer, len);
@@ -1288,6 +1289,7 @@ int vcdc_send_feedback_streaming(int pid, int utt_id, vc_feedback_event_e event,
                utt_id, event, len, variant, NULL, NULL, NULL);
 
        g_object_unref(proxy);
+       g_variant_ref(variant);
        return 0;
 #else
        SLOG(LOG_INFO, TAG_VCD, "[Dbus] Send TTS feedback streaming : pid(%d), utt_id(%d), feedback event(%d), buffer(%p), length(%d)", pid, utt_id, event, buffer, len);
index 421280b..f880201 100644 (file)
@@ -464,7 +464,10 @@ gboolean vcm_daemon_method_get_audio_type(GDBusVcdaemon *service, GDBusMethodInv
        SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd mgr get audio type : pid(%d)", pid);
 
        gdbus_vcdaemon_complete_vcm_daemon_method_get_audio_type(service, invocation, ret, audio_type);
-
+       if (audio_type) {
+               free (audio_type);
+               audio_type = NULL;
+       }
        return TRUE;
 }
 
@@ -3071,4 +3074,4 @@ int vcd_dbus_server_get_tts_audio_format(DBusConnection* conn, DBusMessage* msg)
 
        return 0;
 }
-#endif
\ No newline at end of file
+#endif