Skip to content

Commit ff3bdea

Browse files
committed
stream_read(): Shrink memory block to actual read size.
1 parent decd597 commit ff3bdea

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

py/stream.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ static mp_obj_t stream_read(uint n_args, const mp_obj_t *args) {
3030
if (out_sz == -1) {
3131
nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_OSError, "[Errno %d]", error));
3232
} else {
33+
buf = m_realloc(buf, sz + 1, out_sz + 1);
3334
buf[out_sz] = 0;
3435
return mp_obj_new_str(qstr_from_str_take(buf, /*out_sz,*/ sz + 1));
3536
}

0 commit comments

Comments
 (0)