From ef363de7010b5e13f4e1c0d7b3a109362bda7aa7 Mon Sep 17 00:00:00 2001 From: Jason Evans Date: Mon, 14 Sep 2015 22:45:31 -0700 Subject: [PATCH] Fix irealloc_prof() to prof_alloc_rollback() on OOM. --- ChangeLog | 1 + src/jemalloc.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 18d72ebd..1625776d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -28,6 +28,7 @@ brevity. Much more detail can be found in the git revision history: segfault. - Fix xallocx() bugs related to the 'extra' parameter when specified as non-zero. + - Fix irealloc_prof() to prof_alloc_rollback() on OOM. * 4.0.0 (August 17, 2015) diff --git a/src/jemalloc.c b/src/jemalloc.c index 74fab0fa..68017025 100644 --- a/src/jemalloc.c +++ b/src/jemalloc.c @@ -1712,8 +1712,10 @@ irealloc_prof(tsd_t *tsd, void *oldptr, size_t old_usize, size_t usize) p = irealloc_prof_sample(tsd, oldptr, old_usize, usize, tctx); else p = iralloc(tsd, oldptr, old_usize, usize, 0, false); - if (p == NULL) + if (unlikely(p == NULL)) { + prof_alloc_rollback(tsd, tctx, true); return (NULL); + } prof_realloc(tsd, p, usize, tctx, true, old_usize, old_tctx); return (p);