mirror of
https://github.com/python/cpython.git
synced 2026-04-14 15:50:50 +00:00
gh-144194: Fix mmap failure check in perf_jit_trampoline.c (#143713)
mmap() returns MAP_FAILED ((void*)-1) on error, not NULL. The current check never detects mmap failures, so jitdump initialization proceeds even when the memory mapping fails.
This commit is contained in:
parent
08d7bd28fe
commit
8fe8a94a7c
2 changed files with 3 additions and 1 deletions
|
|
@ -1083,7 +1083,8 @@ static void* perf_map_jit_init(void) {
|
|||
0 // Offset 0 (first page)
|
||||
);
|
||||
|
||||
if (perf_jit_map_state.mapped_buffer == NULL) {
|
||||
if (perf_jit_map_state.mapped_buffer == MAP_FAILED) {
|
||||
perf_jit_map_state.mapped_buffer = NULL;
|
||||
close(fd);
|
||||
return NULL; // Memory mapping failed
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue