halapi: Fix fault by using backend instance before dlclose backend library 84/251684/2 submit/tizen/20210119.012202
authorChanwoo Choi <cw00.choi@samsung.com>
Mon, 18 Jan 2021 10:48:06 +0000 (19:48 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Tue, 19 Jan 2021 01:07:32 +0000 (10:07 +0900)
When try to use backend->name, backend->vendor variables
after dlclose(handle) of HAL backend shared library, segmentation fault happen.
So that move dlclose(hanlde) at the end of hal_common_put_backend() to
fix the segmentation fault.

Change-Id: Icc89e26b0ff11706657f1bfdeff16eba17f255d9
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
src/hal-api-common.c

index 896691c..b07765d 100644 (file)
@@ -172,11 +172,14 @@ int hal_common_put_backend(enum hal_module module, void *data)
                }
        }
 
+       _I("Put HAL backend: name(%s)/vendor(%s)\n",
+                       backend->name, backend->vendor);
+
        if (handle)
                dlclose(handle);
 
-       _I("Put HAL backend: name(%s)/vendor(%s)\n",
-                       backend->name, backend->vendor);
+       hal_module_info[module].library_backend = NULL;
+       hal_module_info[module].library_handle = NULL;
 
        return TIZEN_ERROR_NONE;
 }