Fix heap profiling crash for realloc(p, 0) case.

Fix prof_realloc() to not call prof_ctx_set() if a sampled object is
being freed via realloc(p, 0).
This commit is contained in:
Jason Evans 2012-05-15 13:53:21 -07:00
parent cbb71caceb
commit 3860eac170
2 changed files with 6 additions and 1 deletions

View File

@ -6,6 +6,11 @@ found in the git revision history:
http://www.canonware.com/cgi-bin/gitweb.cgi?p=jemalloc.git
git://canonware.com/jemalloc.git
* 3.x.x (XXX not yet released)
Bug fixes:
- Fix heap profiling crash if sampled object is freed via realloc(p, 0).
* 3.0.0 (May 11, 2012)
Although this version adds some major new features, the primary focus is on

View File

@ -506,7 +506,7 @@ prof_realloc(const void *ptr, size_t size, prof_thr_cnt_t *cnt,
if ((uintptr_t)cnt > (uintptr_t)1U) {
prof_ctx_set(ptr, cnt->ctx);
cnt->epoch++;
} else
} else if (ptr != NULL)
prof_ctx_set(ptr, (prof_ctx_t *)(uintptr_t)1U);
/*********/
mb_write();