[compiler-rt] [scudo] Add hooks to mark the range of realloc (PR #74353)

via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 7 11:37:29 PST 2023


================
@@ -27,15 +27,21 @@ static void reportDeallocation(void *ptr) {
     if (__scudo_deallocate_hook)
       __scudo_deallocate_hook(ptr);
 }
-static void reportReallocBegin(void *old_ptr) {
-  if (SCUDO_ENABLE_HOOKS)
-    if (__scudo_realloc_begin_hook)
-      __scudo_realloc_begin_hook(old_ptr);
+static void reportReallocAllocation(void *old_ptr, void *new_ptr, size_t size) {
+  if (SCUDO_ENABLE_HOOKS) {
+    if (__scudo_realloc_allocate_hook)
+      __scudo_realloc_allocate_hook(old_ptr, new_ptr, size);
+    else
----------------
ChiaHungDuan wrote:

if `new_ptr` == nullptr, it'll be handled differently. See the caller for the detail.

The `else if (__scudo_allocate_hook)` has fixed.

https://github.com/llvm/llvm-project/pull/74353


More information about the llvm-commits mailing list