Skip to content

Commit 5b991ae

Browse files
committed
gc: gc_realloc(): Fix byte-to-block calculation.
1 parent dde739d commit 5b991ae

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

py/gc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ void *gc_realloc(void *ptr_in, machine_uint_t n_bytes) {
480480
}
481481

482482
// compute number of new blocks that are requested
483-
machine_uint_t new_blocks = (n_bytes + BYTES_PER_BLOCK) / BYTES_PER_BLOCK;
483+
machine_uint_t new_blocks = (n_bytes + BYTES_PER_BLOCK - 1) / BYTES_PER_BLOCK;
484484

485485
// get the number of consecutive tail blocks and
486486
// the number of free blocks after last tail block

0 commit comments

Comments
 (0)