diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-02-07 13:04:27 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-02-07 13:04:27 -0500 |
| commit | 2cfe3d285ff001046b579434dea5f963082630dd (patch) | |
| tree | a116e92f6a918c7968c6d1495e25ad680fd780b9 /lib/memory.c | |
| parent | dbcceee45acea4f4285471c4322c3b1ad662a69c (diff) | |
| parent | f65e2d40cc394b716d53ba80c846237c84a68cf0 (diff) | |
Merge pull request #176 from opensourcerouting/mtype-underflow-backtrace
lib: print backtrace on MTYPE count underflow
Diffstat (limited to 'lib/memory.c')
| -rw-r--r-- | lib/memory.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/memory.c b/lib/memory.c index 45aaf7d797..9ec564151a 100644 --- a/lib/memory.c +++ b/lib/memory.c @@ -19,6 +19,7 @@ #include <stdlib.h> #include "memory.h" +#include "log.h" static struct memgroup *mg_first = NULL; struct memgroup **mg_insert = &mg_first; @@ -40,6 +41,11 @@ mt_count_alloc (struct memtype *mt, size_t size) static inline void 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--; } |
