LCOV - code coverage report
Current view: top level - libs/mem/src - mem_reset.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 5 5
Test Date: 2026-03-01 04:31:48 Functions: 100.0 % 1 1
Branches: 50.0 % 2 1

             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 : }
        

Generated by: LCOV version 2.0-1