From: Ji-hoon Lee Date: Thu, 29 Aug 2019 10:06:17 +0000 (+0900) Subject: Add NULL checking when releasing resources X-Git-Tag: accepted/tizen/unified/20191001.062542~2^2~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7b99bb724d5dc1850549bcd54cad056a196a2e5f;p=platform%2Fcore%2Fuifw%2Fmulti-assistant-service.git Add NULL checking when releasing resources Change-Id: I3b1b86e33c97a64be602aefdea8a5ca0d9c774b4 --- diff --git a/plugins/wakeup-manager/dependency-default/src/dependency_default_audio.cpp b/plugins/wakeup-manager/dependency-default/src/dependency_default_audio.cpp index b2c231f..86b2df1 100644 --- a/plugins/wakeup-manager/dependency-default/src/dependency_default_audio.cpp +++ b/plugins/wakeup-manager/dependency-default/src/dependency_default_audio.cpp @@ -214,21 +214,27 @@ void dependency_default_audio_deinitialize() g_volume_stream = NULL; } - ret = audio_in_unprepare(g_audio_in); - if (AUDIO_IO_ERROR_NONE != ret) { - LOGD("[Recorder ERROR] Fail to stop audio : %d", ret); + if (g_audio_in) { + ret = audio_in_unprepare(g_audio_in); + if (AUDIO_IO_ERROR_NONE != ret) { + LOGD("[Recorder ERROR] Fail to stop audio : %d", ret); + } } - if (0 != sound_manager_destroy_stream_information(g_stream_info)) { - LOGD("[Recorder ERROR] Fail to destroy stream info"); + if (g_stream_info) { + if (0 != sound_manager_destroy_stream_information(g_stream_info)) { + LOGD("[Recorder ERROR] Fail to destroy stream info"); + } + g_stream_info = NULL; } - g_stream_info = NULL; - ret = audio_in_destroy(g_audio_in); - if (AUDIO_IO_ERROR_NONE != ret) { - LOGD("[Recorder ERROR] Fail to destroy audio : %d", ret); + if (g_audio_in) { + ret = audio_in_destroy(g_audio_in); + if (AUDIO_IO_ERROR_NONE != ret) { + LOGD("[Recorder ERROR] Fail to destroy audio : %d", ret); + } + g_audio_in = NULL; } - g_audio_in = NULL; } static void recorder_thread_func()