diff options
author | Qi Wang <interwq@gwu.edu> | 2019-07-15 19:16:02 (GMT) |
---|---|---|
committer | Qi Wang <interwq@gmail.com> | 2019-07-24 05:18:55 (GMT) |
commit | 57dbab5d6bc764a8b971334ec80977d6333688af (patch) | |
tree | 290aea63ff7adbe68ffc6c5f43af564657b73167 | |
parent | badf8d95f11cf8ead0f8b7192663002d1d4dc4b2 (diff) | |
download | jemalloc-57dbab5d6bc764a8b971334ec80977d6333688af.zip jemalloc-57dbab5d6bc764a8b971334ec80977d6333688af.tar.gz jemalloc-57dbab5d6bc764a8b971334ec80977d6333688af.tar.bz2 |
Avoid leaking extents / VM when split is not supported.
This can only happen on Windows and with opt.retain disabled (which isn't the
default). The solution is suboptimal, however not a common case as retain is
the long term plan for all platforms anyway.
-rw-r--r-- | src/extent.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/extent.c b/src/extent.c index 416d68f..c6d402b 100644 --- a/src/extent.c +++ b/src/extent.c @@ -1052,6 +1052,17 @@ extent_recycle_split(tsdn_t *tsdn, arena_t *arena, &to_leak, &to_salvage, new_addr, size, pad, alignment, slab, szind, growing_retained); + if (!maps_coalesce && result != extent_split_interior_ok + && !opt_retain) { + /* + * Split isn't supported (implies Windows w/o retain). Avoid + * leaking the extents. + */ + assert(to_leak != NULL && lead == NULL && trail == NULL); + extent_deactivate(tsdn, arena, extents, to_leak); + return NULL; + } + if (result == extent_split_interior_ok) { if (lead != NULL) { extent_deactivate(tsdn, arena, extents, lead); |