diff --git a/buf/buf0flu.c b/buf/buf0flu.c index f866fd105e2..b0fb46c8912 100644 --- a/buf/buf0flu.c +++ b/buf/buf0flu.c @@ -502,7 +502,7 @@ buf_flush_init_for_writing( + (PAGE_HEADER + PAGE_LEVEL)), (ulong) page_zip->m_start, (ulong) 2 - * page_dir_get_n_heap(page_zip->data)); + * (page_dir_get_n_heap(page_zip->data) - 2)); page_zip->data = NULL; } diff --git a/page/page0zip.c b/page/page0zip.c index 8e160bd09b6..c917f3d8820 100644 --- a/page/page0zip.c +++ b/page/page0zip.c @@ -682,8 +682,10 @@ first_inflate: ut_a(d_stream.avail_out < UNIV_PAGE_SIZE - PAGE_ZIP_START - PAGE_DIR); - /* set heap_no and the status bits */ - mach_write_to_2(dst - REC_NEW_HEAP_NO, heap_status); + if (UNIV_LIKELY(d_stream.avail_out != 0)) { + /* set heap_no and the status bits */ + mach_write_to_2(dst - REC_NEW_HEAP_NO, heap_status); + } err = inflate(&d_stream, Z_FINISH);