rewrite fun alloc_read_buf