Commit 952775dc authored by marko's avatar marko

branches/zip: mem_heap_create_block(): Correct an error introduced in r909:

Return NULL when trying to use heap->free_block that is NULL.
parent 438cb8a6
...@@ -379,6 +379,11 @@ mem_heap_create_block( ...@@ -379,6 +379,11 @@ mem_heap_create_block(
buf_block = heap->free_block; buf_block = heap->free_block;
heap->free_block = NULL; heap->free_block = NULL;
if (UNIV_UNLIKELY(!buf_block)) {
return(NULL);
}
} else { } else {
buf_block = buf_block_alloc(0); buf_block = buf_block_alloc(0);
} }
...@@ -387,13 +392,7 @@ mem_heap_create_block( ...@@ -387,13 +392,7 @@ mem_heap_create_block(
} }
} }
if (block == NULL) { ut_ad(block);
/* Only MEM_HEAP_BTR_SEARCH allocation should ever fail. */
ut_a(type & MEM_HEAP_BTR_SEARCH);
return(NULL);
}
block->buf_block = buf_block; block->buf_block = buf_block;
block->magic_n = MEM_BLOCK_MAGIC_N; block->magic_n = MEM_BLOCK_MAGIC_N;
ut_strlcpy_rev(block->file_name, file_name, sizeof(block->file_name)); ut_strlcpy_rev(block->file_name, file_name, sizeof(block->file_name));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment