From 3b5eecf102dcc3eb9a4a50346cdfa96917683e0a Mon Sep 17 00:00:00 2001 From: Yinan Zhang Date: Fri, 15 Nov 2019 11:43:25 -0800 Subject: [PATCH] Fix bug in prof_realloc We should pass in `old_ptr` rather than the new `ptr` to `prof_free_sampled_object()` when `old_ptr` points to a sampled allocation. --- include/jemalloc/internal/prof_inlines_b.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/jemalloc/internal/prof_inlines_b.h b/include/jemalloc/internal/prof_inlines_b.h index 388537e6..3465397b 100644 --- a/include/jemalloc/internal/prof_inlines_b.h +++ b/include/jemalloc/internal/prof_inlines_b.h @@ -203,7 +203,7 @@ prof_realloc(tsd_t *tsd, const void *ptr, size_t usize, prof_tctx_t *tctx, * counters. */ if (unlikely(old_sampled)) { - prof_free_sampled_object(tsd, ptr, old_usize, old_tctx); + prof_free_sampled_object(tsd, old_ptr, old_usize, old_tctx); } }