diff options
author | Christian Hopps <chopps@labn.net> | 2023-11-11 20:27:22 +0100 |
---|---|---|
committer | Christian Hopps <chopps@labn.net> | 2023-11-11 20:30:02 +0100 |
commit | a6c8e08ecdbff443cde703a6f360cbe585f0a6ff (patch) | |
tree | 62480d43ba4aae7f861b521aac8a9cd163a6a9ab | |
parent | Merge pull request #14758 from LabNConsulting/fix-mgmtd-coverity (diff) | |
download | frr-a6c8e08ecdbff443cde703a6f360cbe585f0a6ff.tar.xz frr-a6c8e08ecdbff443cde703a6f360cbe585f0a6ff.zip |
lib: darr needs to use memory.h for both alloc and free
Was using XREALLOC() and then free(). instant "memleaks".
Signed-off-by: Christian Hopps <chopps@labn.net>
-rw-r--r-- | lib/darr.c | 2 | ||||
-rw-r--r-- | lib/darr.h | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/darr.c b/lib/darr.c index bef51b8fc..282e0dc5d 100644 --- a/lib/darr.c +++ b/lib/darr.c @@ -9,7 +9,7 @@ #include "darr.h" #include "memory.h" -DEFINE_MTYPE_STATIC(LIB, DARR, "Dynamic Array"); +DEFINE_MTYPE(LIB, DARR, "Dynamic Array"); static uint _msb(uint count) { diff --git a/lib/darr.h b/lib/darr.h index ca46fb305..d78d97d5f 100644 --- a/lib/darr.h +++ b/lib/darr.h @@ -35,6 +35,9 @@ * - DAs will never have capacity 0 unless they are NULL pointers. */ #include <zebra.h> +#include "memory.h" + +DECLARE_MTYPE(DARR); struct darr_metadata { uint len; @@ -111,7 +114,8 @@ void *__darr_resize(void *a, uint count, size_t esize); #define darr_free(A) \ do { \ if ((A)) { \ - free(_darr_meta(A)); \ + void *__ptr = _darr_meta(A); \ + XFREE(MTYPE_DARR, __ptr); \ (A) = NULL; \ } \ } while (0) |