commit 31932d7cd8845e1a8c2d4a51cc4a6d5f39b7d4e1
parent f17d3542c0c6c3210f10ed1b1d5982df25c9aad7
Author: rhunk <101876869+rhunk@users.noreply.github.com>
Date: Mon, 11 Mar 2024 22:50:32 +0100
fix(native): close file handle
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/native/jni/src/util.h b/native/jni/src/util.h
@@ -74,18 +74,19 @@ namespace util {
if (section_ptr == MAP_FAILED) {
LOGE("mmap failed: %s", strerror(errno));
- return;
+ break;
}
memcpy(section_ptr, (void *)start, section_size);
if (mremap(section_ptr, section_size, section_size, MREMAP_MAYMOVE | MREMAP_FIXED, start) == MAP_FAILED) {
LOGE("mremap failed: %s", strerror(errno));
- return;
+ break;
}
mprotect((void *)start, section_size, (flags[0] == 'r' ? PROT_READ : 0) | (flags[1] == 'w' ? PROT_WRITE : 0) | (flags[2] == 'x' ? PROT_EXEC : 0));
}
+ fclose(maps);
}
static uintptr_t find_signature(uintptr_t module_base, uintptr_t size, const std::string &pattern, int offset = 0) {