Branch data Line data Source code
1 : : #include "mem.h"
2 : :
3 : : #ifdef reset
4 : : #undef reset
5 : : #endif
6 : :
7 : : /**
8 : : * @brief Free the allocation referenced by @p pointer_handle and null it out.
9 : : *
10 : : * Accepts a pointer to any dynamically allocated pointer variable, calls
11 : : * @ref free when the variable is non-NULL, and guarantees @p *pointer_handle
12 : : * becomes NULL afterwards. A NULL handle is ignored.
13 : : *
14 : : * @param pointer_handle Address of the pointer being released.
15 : : */
16 : 413 : void FREE_AND_RESET(void **pointer_handle)
17 : : {
18 [ + - ]: 413 : if(pointer_handle != NULL)
19 : : {
20 : 413 : free(*pointer_handle);
21 : 413 : *pointer_handle = NULL;
22 : : }
23 : 413 : }
|