Check overflows in c-tor instead of doing it in d-tor
Test: bionic-unit-tests --gtest_filter=dl*:Dl* Change-Id: Id3b17a79732155b4e469c43c764afef1dfc59057
This commit is contained in:
parent
3c838bbb4a
commit
68e6c03081
1 changed files with 2 additions and 2 deletions
|
@ -462,13 +462,13 @@ ProtectedDataGuard::ProtectedDataGuard() {
|
|||
if (ref_count_++ == 0) {
|
||||
protect_data(PROT_READ | PROT_WRITE);
|
||||
}
|
||||
}
|
||||
|
||||
ProtectedDataGuard::~ProtectedDataGuard() {
|
||||
if (ref_count_ == 0) { // overflow
|
||||
__libc_fatal("Too many nested calls to dlopen()");
|
||||
}
|
||||
}
|
||||
|
||||
ProtectedDataGuard::~ProtectedDataGuard() {
|
||||
if (--ref_count_ == 0) {
|
||||
protect_data(PROT_READ);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue