mirror of
https://github.com/MariaDB/server.git
synced 2026-05-16 20:07:13 +02:00
Cleanup: Remove mem_block_t::magic_n and mem_block_validate()
Use of freed memory is better caught by AddressSanitizer, especially with ASAN_POISON_MEMORY_REGION that is aliased by MEM_NOACCESS and UNIV_MEM_FREE.
This commit is contained in:
parent
37b9734c06
commit
a9d1324867
3 changed files with 2 additions and 46 deletions
|
|
@ -1,7 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1994, 2014, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation.
|
||||
Copyright (c) 2017, 2020, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
|
|
@ -144,16 +144,6 @@ mem_block_get_start(mem_block_t* block)
|
|||
return(block->start);
|
||||
}
|
||||
|
||||
/** Checks that an object is a memory heap block
|
||||
@param[in] block Memory block to check. */
|
||||
UNIV_INLINE
|
||||
void
|
||||
mem_block_validate(
|
||||
const mem_block_t* block)
|
||||
{
|
||||
ut_a(block->magic_n == MEM_BLOCK_MAGIC_N);
|
||||
}
|
||||
|
||||
/** Allocates and zero-fills n bytes of memory from a memory heap.
|
||||
@param[in] heap memory heap
|
||||
@param[in] n number of bytes; if the heap is allowed to grow into
|
||||
|
|
@ -186,8 +176,6 @@ mem_heap_alloc(
|
|||
byte* buf;
|
||||
ulint free;
|
||||
|
||||
ut_d(mem_block_validate(heap));
|
||||
|
||||
block = UT_LIST_GET_LAST(heap->base);
|
||||
|
||||
n += REDZONE_SIZE;
|
||||
|
|
@ -230,8 +218,6 @@ mem_heap_get_heap_top(
|
|||
mem_block_t* block;
|
||||
byte* buf;
|
||||
|
||||
ut_d(mem_block_validate(heap));
|
||||
|
||||
block = UT_LIST_GET_LAST(heap->base);
|
||||
|
||||
buf = (byte*) block + mem_block_get_free(block);
|
||||
|
|
@ -321,8 +307,6 @@ mem_heap_get_top(
|
|||
mem_block_t* block;
|
||||
byte* buf;
|
||||
|
||||
ut_d(mem_block_validate(heap));
|
||||
|
||||
block = UT_LIST_GET_LAST(heap->base);
|
||||
|
||||
buf = (byte*) block + mem_block_get_free(block) - MEM_SPACE_NEEDED(n);
|
||||
|
|
@ -342,8 +326,6 @@ mem_heap_free_top(
|
|||
{
|
||||
mem_block_t* block;
|
||||
|
||||
ut_d(mem_block_validate(heap));
|
||||
|
||||
n += REDZONE_SIZE;
|
||||
|
||||
block = UT_LIST_GET_LAST(heap->base);
|
||||
|
|
@ -419,8 +401,6 @@ mem_heap_free(
|
|||
mem_block_t* block;
|
||||
mem_block_t* prev_block;
|
||||
|
||||
ut_d(mem_block_validate(heap));
|
||||
|
||||
block = UT_LIST_GET_LAST(heap->base);
|
||||
|
||||
if (heap->free_block) {
|
||||
|
|
@ -447,11 +427,7 @@ mem_heap_get_size(
|
|||
/*==============*/
|
||||
mem_heap_t* heap) /*!< in: heap */
|
||||
{
|
||||
ulint size = 0;
|
||||
|
||||
ut_d(mem_block_validate(heap));
|
||||
|
||||
size = heap->total_size;
|
||||
ulint size = heap->total_size;
|
||||
|
||||
if (heap->free_block) {
|
||||
size += UNIV_PAGE_SIZE;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue