diff options
author | Igor Ryzhov <iryzhov@nfware.com> | 2020-11-30 16:50:51 +0100 |
---|---|---|
committer | Igor Ryzhov <iryzhov@nfware.com> | 2020-11-30 16:55:40 +0100 |
commit | 6df43392d8703df6e92b7ae6e96373e6c3fc5083 (patch) | |
tree | 24694e9cbb47dcc06281f7da2b55b69f98380a74 /lib/memory.c | |
parent | vtysh: fix memory leak (diff) | |
download | frr-6df43392d8703df6e92b7ae6e96373e6c3fc5083.tar.xz frr-6df43392d8703df6e92b7ae6e96373e6c3fc5083.zip |
vtysh: fix incorrect memory statistics
As code comment states, 1 count of MTYPE_COMPLETION is leaked for each
autocompleted token. Let's manually decrement the counter before passing
the pointer to readline.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
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 f715044ea..a377d3b94 100644 --- a/lib/memory.c +++ b/lib/memory.c @@ -127,6 +127,12 @@ void *qstrdup(struct memtype *mt, const char *str) return str ? mt_checkalloc(mt, strdup(str), strlen(str) + 1) : NULL; } +void qcountfree(struct memtype *mt, void *ptr) +{ + if (ptr) + mt_count_free(mt, ptr); +} + void qfree(struct memtype *mt, void *ptr) { if (ptr) |