MCPcopy Create free account
hub / github.com/beefytech/Beef / maybe_check_alloc_ctx

Function maybe_check_alloc_ctx

BeefRT/JEMalloc/src/jemalloc.c:2899–2920  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2897}
2898
2899JEMALLOC_ALWAYS_INLINE bool
2900maybe_check_alloc_ctx(tsd_t *tsd, void *ptr, emap_alloc_ctx_t *alloc_ctx) {
2901 if (config_opt_size_checks) {
2902 emap_alloc_ctx_t dbg_ctx;
2903 emap_alloc_ctx_lookup(tsd_tsdn(tsd), &arena_emap_global, ptr,
2904 &dbg_ctx);
2905 if (alloc_ctx->szind != dbg_ctx.szind) {
2906 safety_check_fail_sized_dealloc(
2907 /* current_dealloc */ true, ptr,
2908 /* true_size */ sz_size2index(dbg_ctx.szind),
2909 /* input_size */ sz_size2index(alloc_ctx->szind));
2910 return true;
2911 }
2912 if (alloc_ctx->slab != dbg_ctx.slab) {
2913 safety_check_fail(
2914 "Internal heap corruption detected: "
2915 "mismatch in slab bit");
2916 return true;
2917 }
2918 }
2919 return false;
2920}
2921
2922JEMALLOC_ALWAYS_INLINE void
2923isfree(tsd_t *tsd, void *ptr, size_t usize, tcache_t *tcache, bool slow_path) {

Callers 2

isfreeFunction · 0.85
free_fastpathFunction · 0.85

Calls 5

emap_alloc_ctx_lookupFunction · 0.85
tsd_tsdnFunction · 0.85
sz_size2indexFunction · 0.85
safety_check_failFunction · 0.85

Tested by

no test coverage detected