summaryrefslogtreecommitdiff
path: root/lib/memory.c
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2020-11-30 18:50:51 +0300
committerIgor Ryzhov <iryzhov@nfware.com>2020-11-30 18:55:40 +0300
commit6df43392d8703df6e92b7ae6e96373e6c3fc5083 (patch)
tree24694e9cbb47dcc06281f7da2b55b69f98380a74 /lib/memory.c
parent40ab41115dd415cc42e311a96d66bb83ce4f1150 (diff)
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.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/memory.c b/lib/memory.c
index f715044ea3..a377d3b945 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)