linker: Fix fd leak
Close the file descriptor before throwing it away.
Test: mmma bionic
Change-Id: I1690c1bb8b619f82070503151b1de73302882310
diff --git a/linker/linker.cpp b/linker/linker.cpp
index f085863..e866c3d 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -1086,6 +1086,7 @@
fd = open_library_on_paths(zip_archive_cache, name, file_offset, needed_by->get_dt_runpath(), realpath);
// Check if the library is accessible
if (fd != -1 && !ns->is_accessible(*realpath)) {
+ close(fd);
fd = -1;
}
}