![]() |
Wireshark 4.7.0
The Wireshark network protocol analyzer
|
#include "wmem_core.h"
Go to the source code of this file.
Functions | |
void | wmem_strict_allocator_init (wmem_allocator_t *allocator) |
Initialize a strict memory allocator. | |
void | wmem_strict_check_canaries (wmem_allocator_t *allocator) |
Verify memory canaries for a strict allocator. | |
Definitions for the Wireshark Memory Manager Strict Allocator Copyright 2012, Evan Huus eapac.nosp@m.he@g.nosp@m.mail..nosp@m.com
Wireshark - Network traffic analyzer By Gerald Combs geral.nosp@m.d@wi.nosp@m.resha.nosp@m.rk.o.nosp@m.rg Copyright 1998 Gerald Combs
SPDX-License-Identifier: GPL-2.0-or-later
void wmem_strict_allocator_init | ( | wmem_allocator_t * | allocator | ) |
Initialize a strict memory allocator.
Sets up a wmem_allocator_t
to use a strict allocation strategy that enforces tighter control over memory usage. In this allocator, we do everything we can to catch invalid memory accesses. This includes using canaries (what Valgrind calls redzones) and filling allocated and freed memory with garbage. Valgrind is still the better tool on the platforms where it is available - use it instead if possible.
Initializes function pointers for allocation, reallocation, freeing, and cleanup, and sets up internal block tracking.
allocator | Pointer to the allocator structure to initialize. |
void wmem_strict_check_canaries | ( | wmem_allocator_t * | allocator | ) |
Verify memory canaries for a strict allocator.
Performs integrity checks on all memory blocks managed by a strict allocator by validating their canary values. This helps detect memory corruption such as buffer overflows or underflows.
This function only operates if the allocator's type is WMEM_ALLOCATOR_STRICT
. If the allocator is not of this type, the function returns immediately.
allocator | Pointer to the strict memory allocator to check. |