From 69f49f79e4e2c8ee7d611fb6e5a5212fd8020132 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Wed, 5 Feb 2025 23:29:43 +0100 Subject: [DYNAREC] Fixed a potential SEGFAULT in FindDynablockFromNativeAddress, and added aprofile for BeamNG.drive linux version (for #424) --- src/custommem.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/custommem.c b/src/custommem.c index 6846b77b..87328bc1 100644 --- a/src/custommem.c +++ b/src/custommem.c @@ -812,8 +812,10 @@ dynablock_t* FindDynablockFromNativeAddress(void* p) uintptr_t addr = (uintptr_t)p; mapchunk_t* bl = (mapchunk_t*)rb_get_64(rbt_dynmem, (uintptr_t)p); - if(bl) - return *(dynablock_t**)rb_get_64(bl->tree, (uintptr_t)p); + if(bl) { + dynablock_t** ret = (dynablock_t**)rb_get_64(bl->tree, (uintptr_t)p); + if(ret) return *ret; + } return NULL; } -- cgit 1.4.1