Fix: Memory Leak in HAL layer. 77/225777/1
authorhimanshu <h.himanshu@samsung.com>
Wed, 19 Feb 2020 13:30:59 +0000 (19:00 +0530)
committerhimanshu <h.himanshu@samsung.com>
Mon, 24 Feb 2020 10:01:58 +0000 (15:31 +0530)
Change-Id: Ib55dbe3b0fa3aa91eb3fd3d8bbb41365b457c5ef
Signed-off-by: himanshu <h.himanshu@samsung.com>
bt-oal/oal-manager.c

index 0d28d52..7ae3e67 100644 (file)
@@ -44,6 +44,7 @@
 
 static const hw_module_t* module = NULL;
 static const bt_interface_t *blued_api = NULL;
+static bluetooth_device_t* bt_device = NULL;
 
 static gboolean unload_libs(gpointer data);
 static bluetooth_device_t* load_hal_lib(void);
@@ -53,8 +54,6 @@ static int unload(const struct hw_module_t *module);
 
 oal_status_t oal_mgr_init_internal(void)
 {
-       bluetooth_device_t* bt_device;
-
        bt_device = load_hal_lib();
 
        if (bt_device == NULL) {
@@ -128,6 +127,7 @@ gboolean oal_lib_init(gpointer data)
 
 static gboolean unload_libs(gpointer data)
 {
+       bt_device->common.close((hw_device_t*)bt_device);
        unload((hw_module_t const*)module);
        module = NULL;
        return FALSE;
@@ -137,7 +137,6 @@ static bluetooth_device_t* load_hal_lib(void)
 {
        int err = 0;
        hw_device_t* device;
-       bluetooth_device_t* bt_device = NULL;
 
        BT_DBG("Loading HAL lib");
        if (module == NULL) {