Add null check when destroy sound manager vstream 38/177038/2
authorGilbok Lee <gilbok.lee@samsung.com>
Wed, 25 Apr 2018 01:51:36 +0000 (10:51 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Wed, 25 Apr 2018 06:27:27 +0000 (06:27 +0000)
[Version] 0.2.39
[Profile] Mobile, Wearable
[Issue Type] Fix bug

Change-Id: I5ecf00204dd228d609799b66b24e0a0e497bc2f8

packaging/libmm-radio.spec
src/mm_radio_priv_hal.c

index 3833445..c6bf627 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       libmm-radio
 Summary:    Multimedia Framework Radio Library
-Version:    0.2.38
+Version:    0.2.39
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index 3d1f8d6..ac1cd92 100644 (file)
@@ -196,6 +196,8 @@ int _mmradio_create_radio(mm_radio_t *radio)
        radio->freq = DEFAULT_FREQ;
        memset(&radio->region_setting, 0, sizeof(MMRadioRegion_t));
        radio->local_volume = 1.0;
+       radio->vstream = NULL;
+       radio->stream_info = NULL;
 
        /* create msg queue for msg thread */
        radio->msg_queue = g_async_queue_new();
@@ -329,8 +331,14 @@ int _mmradio_unrealize(mm_radio_t *radio)
        _mmradio_stop(radio);
 
 #ifdef TIZEN_FEATURE_SOUND_VSTREAM
-       sound_manager_destroy_virtual_stream(radio->vstream);
-       sound_manager_destroy_stream_information(radio->stream_info);
+       if (radio->vstream) {
+               sound_manager_destroy_virtual_stream(radio->vstream);
+               radio->vstream = NULL;
+       }
+       if (radio->stream_info) {
+               sound_manager_destroy_stream_information(radio->stream_info);
+               radio->stream_info = NULL;
+       }
 #endif
 
        MMRADIO_SET_STATE(radio, MM_RADIO_STATE_NULL);