Fix OOM paths in extent_grow_retained().
This commit is contained in:
parent
d5ef5ae934
commit
a16114866a
10
src/extent.c
10
src/extent.c
@ -1046,10 +1046,15 @@ extent_grow_retained(tsdn_t *tsdn, arena_t *arena,
|
|||||||
extent_init(extent, arena, ptr, alloc_size, false, NSIZES,
|
extent_init(extent, arena, ptr, alloc_size, false, NSIZES,
|
||||||
arena_extent_sn_next(arena), extent_state_active, zeroed,
|
arena_extent_sn_next(arena), extent_state_active, zeroed,
|
||||||
committed);
|
committed);
|
||||||
if (ptr == NULL || extent_register_no_gdump_add(tsdn, extent)) {
|
if (ptr == NULL) {
|
||||||
extent_dalloc(tsdn, arena, extent);
|
extent_dalloc(tsdn, arena, extent);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if (extent_register_no_gdump_add(tsdn, extent)) {
|
||||||
|
extents_leak(tsdn, arena, r_extent_hooks,
|
||||||
|
&arena->extents_retained, extent);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
size_t leadsize = ALIGNMENT_CEILING((uintptr_t)ptr,
|
size_t leadsize = ALIGNMENT_CEILING((uintptr_t)ptr,
|
||||||
PAGE_CEILING(alignment)) - (uintptr_t)ptr;
|
PAGE_CEILING(alignment)) - (uintptr_t)ptr;
|
||||||
@ -1070,7 +1075,8 @@ extent_grow_retained(tsdn_t *tsdn, arena_t *arena,
|
|||||||
leadsize, NSIZES, false, esize + trailsize, szind, slab);
|
leadsize, NSIZES, false, esize + trailsize, szind, slab);
|
||||||
if (extent == NULL) {
|
if (extent == NULL) {
|
||||||
extent_deregister(tsdn, lead);
|
extent_deregister(tsdn, lead);
|
||||||
extents_leak(tsdn, arena, r_extent_hooks, false, lead);
|
extents_leak(tsdn, arena, r_extent_hooks,
|
||||||
|
&arena->extents_retained, lead);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
extent_record(tsdn, arena, r_extent_hooks,
|
extent_record(tsdn, arena, r_extent_hooks,
|
||||||
|
Loading…
Reference in New Issue
Block a user