Merge "linker: cleanup solist after unsuccessful read"
This commit is contained in:
commit
3482613685
@ -1523,6 +1523,8 @@ static bool load_library(LoadTask* task,
|
|||||||
|
|
||||||
// Read the ELF header and some of the segments.
|
// Read the ELF header and some of the segments.
|
||||||
if (!task->read(realpath.c_str(), file_stat.st_size)) {
|
if (!task->read(realpath.c_str(), file_stat.st_size)) {
|
||||||
|
soinfo_free(si);
|
||||||
|
task->set_soinfo(nullptr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,6 +169,11 @@ TEST_F(DlExtTest, ExtInfoUseFdWithInvalidOffset) {
|
|||||||
ASSERT_TRUE(handle_ == nullptr);
|
ASSERT_TRUE(handle_ == nullptr);
|
||||||
ASSERT_EQ("dlopen failed: \"" + lib_realpath + "\" has bad ELF magic", dlerror());
|
ASSERT_EQ("dlopen failed: \"" + lib_realpath + "\" has bad ELF magic", dlerror());
|
||||||
|
|
||||||
|
// Check if dlsym works after unsuccessful dlopen().
|
||||||
|
// Supply non-exiting one to make linker visit every soinfo.
|
||||||
|
void* sym = dlsym(RTLD_DEFAULT, "this_symbol_does_not_exist___");
|
||||||
|
ASSERT_TRUE(sym == nullptr);
|
||||||
|
|
||||||
close(extinfo.library_fd);
|
close(extinfo.library_fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user