Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 79e7c952 authored by Surendar Karka's avatar Surendar Karka
Browse files

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
parent d6d24596
Loading
Loading
Loading
Loading
+8 −1
Original line number Original line Diff line number Diff line
@@ -1113,6 +1113,7 @@ int qahw_get_version()


int qahw_unload_module(qahw_module_handle_t *hw_module)
int qahw_unload_module(qahw_module_handle_t *hw_module)
{
{
    int rc = -EINVAL;
    ALOGV("%d:%s",__LINE__, __func__);
    ALOGV("%d:%s",__LINE__, __func__);
    if (g_binder_enabled) {
    if (g_binder_enabled) {
        if (!g_qas_died && ((g_qas_load_count > 0) && (--g_qas_load_count == 0))) {
        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)
            if (qas_status(qas) == -1)
                return -ENODEV;
                return -ENODEV;
            pthread_mutex_destroy(&list_lock);
            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 {
        } else {
            return -ENODEV;
            return -ENODEV;
        }
        }