Fix issue detected by static analysis tool
[platform/core/uifw/inputdelegator.git] / src / w-input-stt-voice.cpp
old mode 100755 (executable)
new mode 100644 (file)
index 7ce7973..63f4c31
@@ -452,11 +452,13 @@ static void on_confirm_button_clicked_cb(void *data, Evas_Object *obj, void *eve
        }
 
        SECURE_LOGD("result_text = %s", result_text.c_str());
+       stop_voice_recorder();
 
        char *filePath = NULL;
        voice_recorder *vr = _voice_recorder_get_data();
-       if (!vr)
+       if (vr)
                filePath = vr->file_path;
+
        char *path[] = {filePath, };
        reply_to_sender_by_callback(result_text.c_str(), "voice", (const char **)path, NULL);
        destroy_voice();
@@ -525,7 +527,6 @@ static Eina_Bool _idler_cb(void *data)
 
        PRINTFUNC(DLOG_DEBUG, "");
 
-
        if (true == _app_stt_initialize(voicedata)) {
                LOGD("_app_stt_initialize None Error");
                voicedata->voicefw_state = 1;
@@ -855,7 +856,7 @@ void on_initial_anim_press_cb(void *data, Evas_Object *obj, const char *emission
 
        int tempVal = vd->sttmanager->GetCurrent();
        if(tempVal == STT_STATE_CREATED) {
-               PRINTFUNC(DLOG_WARN, "IGNORE TOUCH event before STT READY. STT is preparing", vd->state);
+               PRINTFUNC(DLOG_WARN, "IGNORE TOUCH event before STT READY. STT is preparing");
                return;
        }
 
@@ -1586,6 +1587,9 @@ static void _stt_entry_clicked_cb(void *data, Evas_Object * obj, void *event_inf
                elm_naviframe_item_pop_cb_set(navi_it, __stt_entry_detailed_view_pop_cb, (void *)voicedata);
                elm_naviframe_item_title_enabled_set(navi_it, EINA_FALSE, EINA_FALSE);
                free(str);
+       } else {
+               if (str) free(str);
+               str = NULL;
        }
 
        return;
@@ -1941,6 +1945,7 @@ int init_voicedata(VoiceData *r_voicedata)
        voicedata->main_entry = NULL;
        voicedata->state = STT_STATE_VAL_INIT;
        voicedata->kbd_lang = NULL;
+       voicedata->setup_timer = NULL;
        voicedata->start_timer = NULL;
        voicedata->refresh_timer = NULL;
        voicedata->textblock_timer = NULL;