mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-23 13:13:06 +00:00
Fix memory leak of old curr_reg on san_bump_grow_locked failure
When san_bump_grow_locked fails, it sets sba->curr_reg to NULL. The old curr_reg (saved in to_destroy) was never freed or restored, leaking the virtual memory extent. Restore sba->curr_reg from to_destroy on failure so the old region remains usable.
This commit is contained in:
@@ -31,6 +31,7 @@ san_bump_alloc(tsdn_t *tsdn, san_bump_alloc_t *sba, pac_t *pac,
|
||||
bool err = san_bump_grow_locked(
|
||||
tsdn, sba, pac, ehooks, guarded_size);
|
||||
if (err) {
|
||||
sba->curr_reg = to_destroy;
|
||||
goto label_err;
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user