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

Commit 7bf551cf authored by zhongjie's avatar zhongjie Committed by Zhao Wei Liew
Browse files

Release resources when repeating dlopen-dlcose.



When the libbinder.so is dlopen and dlclose many
times, we need to delete the pthread_key and
munmap the memory mapping.

Otherwise, it will crash as the leakage causes
the pthread_key or memory mapping surpass their
limit.

Change-Id: Ice64d4ef685c1f665350286f9e5ddf790beac236
Signed-off-by: default avatarzhongjie <zhongjie.shi@intel.com>
(cherry picked from commit 3d919ec2)
parent d827c05a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -330,6 +330,7 @@ void IPCThreadState::shutdown()
            delete st;
            pthread_setspecific(gTLS, NULL);
        }
        pthread_key_delete(gTLS);
        gHaveTLS = false;
    }
}
+7 −0
Original line number Diff line number Diff line
@@ -366,6 +366,13 @@ ProcessState::ProcessState()

ProcessState::~ProcessState()
{
    if (mDriverFD >= 0) {
        if (mVMStart != MAP_FAILED) {
            munmap(mVMStart, BINDER_VM_SIZE);
        }
        close(mDriverFD);
    }
    mDriverFD = -1;
}
        
}; // namespace android