Fix coverity issue (pointer deference) 42/189742/1 accepted/tizen/unified/20180927.174502 submit/tizen/20180927.045034 submit/tizen/20180927.073913
authorsooyeon.kim <sooyeon.kim@samsung.com>
Thu, 20 Sep 2018 06:40:39 +0000 (15:40 +0900)
committersooyeon.kim <sooyeon.kim@samsung.com>
Thu, 20 Sep 2018 06:40:39 +0000 (15:40 +0900)
Change-Id: I545ff21f6efa01fc1a905f57f6ea0009068062da
Signed-off-by: sooyeon.kim <sooyeon.kim@samsung.com>
client/vc_mgr.c

index 17bbbb8cb9c782fb6243845fc839abe8c1bcc337..8493fb9e1f137140df75ac39b7fd21d075201ce5 100644 (file)
@@ -4068,50 +4068,53 @@ static void __tts_feedback_thread(void* data, Ecore_Thread* thread)
                        continue;
                }
 
-               if (getpid() == feedback_data->pid) {
-                       vc_mgr_feedback_streaming_cb callback = NULL;
-                       void* user_data = NULL;
-
-                       vc_mgr_client_get_feedback_streaming_cb(g_vc_m, &callback, &user_data);
-                       if (NULL == callback) {
-                               SLOG(LOG_WARN, TAG_VCM, "[WARNING] TTS feedback streaming callback is null");
-                               return;
-                       }
+               if (NULL != feedback_data) {
+                       if (getpid() == feedback_data->pid) {
+                               vc_mgr_feedback_streaming_cb callback = NULL;
+                               void* user_data = NULL;
+
+                               vc_mgr_client_get_feedback_streaming_cb(g_vc_m, &callback, &user_data);
+                               if (NULL == callback) {
+                                       SLOG(LOG_WARN, TAG_VCM, "[WARNING] TTS feedback streaming callback is null");
+                                       vc_mgr_data_clear_feedback_data(&feedback_data);
+                                       return;
+                               }
 
-               SLOG(LOG_DEBUG, TAG_VCM, "TTS feedback streaming callback is called");
-               vc_mgr_client_use_callback(g_vc_m);
-               callback(feedback_data->event, feedback_data->data, feedback_data->data_size, user_data);
-               vc_mgr_client_not_use_callback(g_vc_m);
+                               SLOG(LOG_DEBUG, TAG_VCM, "TTS feedback streaming callback is called");
+                               vc_mgr_client_use_callback(g_vc_m);
+                               callback(feedback_data->event, feedback_data->data, feedback_data->data_size, user_data);
+                               vc_mgr_client_not_use_callback(g_vc_m);
 
-               /* If no feedback data and EVENT_FINISH */
-               if (0 >= vc_mgr_data_get_feedback_data_size() && VC_FEEDBACK_EVENT_FINISH == feedback_data->event) {
-                       SLOG(LOG_INFO, TAG_VCM, "[INFO] Finish feedback");
-                       break;
-               }
-               } else {
-                       vc_mgr_vc_tts_streaming_cb callback = NULL;
-                       void* user_data = NULL;
-
-                       vc_mgr_client_get_vc_tts_streaming_cb(g_vc_m, &callback, &user_data);
-                       if (NULL == callback) {
-                               SLOG(LOG_WARN, TAG_VCM, "[WARNING] vc tts streaming callback is null");
-                               vc_mgr_data_clear_feedback_data(&feedback_data);
-                               return;
-                       }
+                               /* If no feedback data and EVENT_FINISH */
+                               if (0 >= vc_mgr_data_get_feedback_data_size() && VC_FEEDBACK_EVENT_FINISH == feedback_data->event) {
+                                       SLOG(LOG_INFO, TAG_VCM, "[INFO] Finish feedback");
+                                       break;
+                               }
+                       } else {
+                               vc_mgr_vc_tts_streaming_cb callback = NULL;
+                               void* user_data = NULL;
 
-                       SLOG(LOG_DEBUG, TAG_VCM, "vc tts feedback streaming callback is called");
-                       vc_mgr_client_use_callback(g_vc_m);
-                       callback(feedback_data->pid, feedback_data->utt_id, feedback_data->event, feedback_data->data, feedback_data->data_size, user_data);
-                       vc_mgr_client_not_use_callback(g_vc_m);
+                               vc_mgr_client_get_vc_tts_streaming_cb(g_vc_m, &callback, &user_data);
+                               if (NULL == callback) {
+                                       SLOG(LOG_WARN, TAG_VCM, "[WARNING] vc tts streaming callback is null");
+                                       vc_mgr_data_clear_feedback_data(&feedback_data);
+                                       return;
+                               }
 
-                       /* If no feedback data and EVENT_FINISH */
-                       if (0 >= vc_mgr_data_get_feedback_data_size() && VC_FEEDBACK_EVENT_FINISH == feedback_data->event) {
-                               SLOG(LOG_INFO, TAG_VCM, "[INFO] Finish vc tts feedback");
-                               break;
+                               SLOG(LOG_DEBUG, TAG_VCM, "vc tts feedback streaming callback is called");
+                               vc_mgr_client_use_callback(g_vc_m);
+                               callback(feedback_data->pid, feedback_data->utt_id, feedback_data->event, feedback_data->data, feedback_data->data_size, user_data);
+                               vc_mgr_client_not_use_callback(g_vc_m);
+
+                               /* If no feedback data and EVENT_FINISH */
+                               if (0 >= vc_mgr_data_get_feedback_data_size() && VC_FEEDBACK_EVENT_FINISH == feedback_data->event) {
+                                       SLOG(LOG_INFO, TAG_VCM, "[INFO] Finish vc tts feedback");
+                                       break;
+                               }
                        }
-               }
-               if (feedback_data)
                        free(feedback_data);
+                       feedback_data = NULL;
+               }
        }
 }