Fix memory leak 42/112642/1
authorGilbok Lee <gilbok.lee@samsung.com>
Thu, 2 Feb 2017 05:38:33 +0000 (14:38 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Thu, 2 Feb 2017 05:38:33 +0000 (14:38 +0900)
[Version] 0.2.20
[Profile] Mobile, Wearable
[Issue Type] Fix bugs

Change-Id: Ie34d49b9f60218440fb2e6210161accbc2775ceb

packaging/libmm-radio.spec
src/mm_radio_sound_focus.c
src/radio_hal_interface.c

index edc364d..6e5c404 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       libmm-radio
 Summary:    Multimedia Framework Radio Library
-Version:    0.2.19
+Version:    0.2.20
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index cbfe624..68760dc 100644 (file)
@@ -74,7 +74,6 @@ void _mmradio_sound_signal_callback(mm_sound_signal_name_t signal, int value, vo
                        /* unregister watch callback */
                        if (sound_focus->watch_id > 0) {
                                MMRADIO_LOG_DEBUG("unset the focus watch cb %d", sound_focus->watch_id);
-
                                ret = mm_sound_unset_focus_watch_callback(sound_focus->watch_id);
                                sound_focus->watch_id = 0;
                                if (ret != MM_ERROR_NONE)
@@ -82,6 +81,7 @@ void _mmradio_sound_signal_callback(mm_sound_signal_name_t signal, int value, vo
                        }
                        /* unregister focus callback */
                        if (sound_focus->focus_id > 0) {
+                               MMRADIO_LOG_DEBUG("unset the focus %d", sound_focus->focus_id);
                                ret = mm_sound_unregister_focus(sound_focus->focus_id);
                                sound_focus->focus_id = 0;
                                if (ret != MM_ERROR_NONE)
@@ -129,7 +129,7 @@ int mmradio_sound_focus_register(mm_radio_sound_focus *sound_focus,
                                MMRADIO_LOG_ERROR("mm_sound_subscribe_signal is failed\n");
                                return MM_ERROR_POLICY_BLOCKED;
                        }
-                       MMRADIO_LOG_DEBUG("register focus watch callback for the value is 0, sub_cb id %d\n", sound_focus->subscribe_id);
+                       MMRADIO_LOG_DEBUG("register mm_sound_subscribe_signal_for_daemon subscribe_id %d\n", sound_focus->subscribe_id);
                        /* register watch callback */
                        ret = mm_sound_set_focus_watch_callback_for_session(pid,
                                        FOCUS_FOR_BOTH, watch_cb, (void *)param, &sound_focus->watch_id);
@@ -262,6 +262,11 @@ int mmradio_sound_focus_deregister(mm_radio_sound_focus *sound_focus)
                        MMRADIO_LOG_ERROR("failed to mm_sound_remove_device_connected_callback() ret = %d", ret);
        }
 
+       if (sound_focus->subscribe_id > 0) {
+               MMRADIO_LOG_DEBUG("unset mm_sound_subscribe_signal_for_daemon %d", sound_focus->subscribe_id);
+               mm_sound_unsubscribe_signal(sound_focus->subscribe_id);
+       }
+
        MMRADIO_LOG_FLEAVE();
 
        return MM_ERROR_NONE;
index 86b449b..567c469 100644 (file)
@@ -133,7 +133,7 @@ int radio_hal_interface_init(mm_radio_hal_interface **handle)
 
        *handle = h;
 
-       MMRADIO_LOG_ERROR("open radio_hal interface");
+       MMRADIO_LOG_DEBUG("open radio_hal interface");
 
        return MM_ERROR_NONE;
 FAIL:
@@ -158,6 +158,7 @@ int radio_hal_interface_deinit(mm_radio_hal_interface *handle)
 
                handle->rh_handle = NULL;
 
+               MMRADIO_LOG_DEBUG("close radio_hal interface");
                dlclose(handle->dl_handle);
                handle->dl_handle = NULL;
        }