summaryrefslogtreecommitdiff
path: root/qahw_api/src/qahw_api.cpp
diff options
context:
space:
mode:
authorSurendar Karka <skarka@codeaurora.org>2018-05-11 18:56:49 +0530
committerSurendar Karka <skarka@codeaurora.org>2018-05-17 15:32:12 +0530
commit79e7c952fa7869bb9543b5c229547a9a8b4ad63e (patch)
tree980603ae155064adcff868f5def293639880a2c5 /qahw_api/src/qahw_api.cpp
parentd6d24596d6d26402cddbd7883e2c68ad236131c6 (diff)
qahw_api: call unlinkToDeath to avoid segmentation fault
Segmentation fault is observed while client cleaning up/closing the session as death notifier is not released. Calling unlinkToDeath to avoid segmentation fault. Change-Id: Ibc855396a25b80103302298306438e84c29eda23
Diffstat (limited to 'qahw_api/src/qahw_api.cpp')
-rw-r--r--qahw_api/src/qahw_api.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/qahw_api/src/qahw_api.cpp b/qahw_api/src/qahw_api.cpp
index 8967e795..cbd90410 100644
--- a/qahw_api/src/qahw_api.cpp
+++ b/qahw_api/src/qahw_api.cpp
@@ -1113,6 +1113,7 @@ int qahw_get_version()
int qahw_unload_module(qahw_module_handle_t *hw_module)
{
+ int rc = -EINVAL;
ALOGV("%d:%s",__LINE__, __func__);
if (g_binder_enabled) {
if (!g_qas_died && ((g_qas_load_count > 0) && (--g_qas_load_count == 0))) {
@@ -1120,7 +1121,13 @@ int qahw_unload_module(qahw_module_handle_t *hw_module)
if (qas_status(qas) == -1)
return -ENODEV;
pthread_mutex_destroy(&list_lock);
- return qas->qahw_unload_module(hw_module);
+ rc = qas->qahw_unload_module(hw_module);
+ if (g_death_notifier != NULL) {
+ IInterface::asBinder(qas)->unlinkToDeath(g_death_notifier);
+ g_death_notifier.clear();
+ }
+ g_qas = NULL;
+ return rc;
} else {
return -ENODEV;
}