Fix crash caused by uninitialized pointer variable 71/214971/1
authorJi-hoon Lee <dalton.lee@samsung.com>
Mon, 30 Sep 2019 08:28:25 +0000 (17:28 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Mon, 30 Sep 2019 08:28:38 +0000 (17:28 +0900)
Change-Id: I63c6fe9a457085544c013555e169b3cd1882df5e

plugins/wakeup-manager/src/wakeup_audio_manager.cpp

index d7ca9b0..8b68362 100644 (file)
@@ -77,7 +77,7 @@ void CAudioManager::sound_focus_changed()
 {
        sound_stream_focus_change_reason_e acquired_by;
        int sound_behavior;
-       char* extra_info;
+       char* extra_info = NULL;
        int focus = sound_manager_get_current_recording_focus(&acquired_by, &sound_behavior, &extra_info);
        MWR_LOGD("[Recorder] sound focus has changed : %d %d %d %s", focus,
                (SOUND_MANAGER_ERROR_NO_DATA != focus ? acquired_by : -1),
@@ -95,7 +95,7 @@ void CAudioManager::sound_focus_changed()
                }
        }
        if (extra_info) {
-               free (extra_info);
+               free(extra_info);
                extra_info = NULL;
        }
 }
@@ -133,7 +133,7 @@ void CAudioManager::start_recording(bool proactive)
 
        sound_stream_focus_change_reason_e acquired_by;
        int sound_behavior;
-       char* extra_info;
+       char* extra_info = NULL;
        if (SOUND_MANAGER_ERROR_NO_DATA == sound_manager_get_current_recording_focus(&acquired_by, &sound_behavior, &extra_info)) {
                MWR_LOGD("[Recorder] Currently no other process has acquired sound focus, start recording");
                dependency_resolver_start_recording();
@@ -142,7 +142,7 @@ void CAudioManager::start_recording(bool proactive)
                MWR_LOGW("[Recorder] Currently sound focus is acquired by other process, skip recording");
        }
        if (extra_info) {
-               free (extra_info);
+               free(extra_info);
                extra_info = NULL;
        }
 }