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

@@ -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();