mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 03:53:38 +00:00
lib: print backtrace on MTYPE count underflow
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
parent
62fb7b19e8
commit
f65e2d40cc
@ -19,6 +19,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
static struct memgroup *mg_first = NULL;
|
static struct memgroup *mg_first = NULL;
|
||||||
struct memgroup **mg_insert = &mg_first;
|
struct memgroup **mg_insert = &mg_first;
|
||||||
@ -40,6 +41,11 @@ mt_count_alloc (struct memtype *mt, size_t size)
|
|||||||
static inline void
|
static inline void
|
||||||
mt_count_free (struct memtype *mt)
|
mt_count_free (struct memtype *mt)
|
||||||
{
|
{
|
||||||
|
if (mt->n_alloc == 0)
|
||||||
|
{
|
||||||
|
zlog_err ("memory allocation count underflow for \"%s\"", mt->name);
|
||||||
|
zlog_backtrace (LOG_ERR);
|
||||||
|
}
|
||||||
mt->n_alloc--;
|
mt->n_alloc--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user