Skip to content

Commit a454152

Browse files
committed
Auto merge of #45514 - gnzlbg:jemalloc_realloc2, r=sfackler
[jemalloc] set correct excess in realloc_excess
2 parents 95a4016 + 549ab77 commit a454152

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/liballoc_jemalloc/lib.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ mod contents {
203203
err: *mut u8) -> *mut u8 {
204204
let p = __rde_alloc(size, align, err);
205205
if !p.is_null() {
206-
*excess = size;
206+
let flags = align_to_flags(align);
207+
*excess = nallocx(size, flags) as usize;
207208
}
208209
return p
209210
}
@@ -219,9 +220,10 @@ mod contents {
219220
err: *mut u8) -> *mut u8 {
220221
let p = __rde_realloc(ptr, old_size, old_align, new_size, new_align, err);
221222
if !p.is_null() {
222-
*excess = new_size;
223+
let flags = align_to_flags(new_align);
224+
*excess = nallocx(new_size, flags) as usize;
223225
}
224-
return p
226+
p
225227
}
226228

227229
#[no_mangle]

0 commit comments

Comments
 (0)