From 284a9ca4b7cbdb615de15f6c7a16f35ca327b4dc Mon Sep 17 00:00:00 2001 From: Bryan Roe Date: Mon, 8 Aug 2022 13:52:45 -0700 Subject: [PATCH] Fixed leak of a LinkedList by LifeTimeMonitor Fixed leak of X509 structure by ControlChannelCertificate property of MeshAgent --- meshcore/agentcore.c | 4 +++- microstack/ILibParsers.c | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/meshcore/agentcore.c b/meshcore/agentcore.c index 82ae754..c869032 100644 --- a/meshcore/agentcore.c +++ b/meshcore/agentcore.c @@ -1654,7 +1654,9 @@ duk_ret_t ILibDuktape_MeshAgent_ServerInfo(duk_context *ctx) #ifndef MICROSTACK_NOTLS if (agent->controlChannel != NULL) { - ILibDuktape_TLS_X509_PUSH(ctx, ILibWebClient_SslGetCert(agent->controlChannel)); + X509 *cert = ILibWebClient_SslGetCert(agent->controlChannel); + ILibDuktape_TLS_X509_PUSH(ctx, cert); + X509_free(cert); } else { diff --git a/microstack/ILibParsers.c b/microstack/ILibParsers.c index 0370f1d..2e1349a 100644 --- a/microstack/ILibParsers.c +++ b/microstack/ILibParsers.c @@ -7997,6 +7997,7 @@ void ILibLifeTime_Destroy(void *LifeTimeToken) struct ILibLifeTime *UPnPLifeTime = (struct ILibLifeTime*)LifeTimeToken; ILibLifeTime_Flush(LifeTimeToken); ILibLinkedList_Destroy(UPnPLifeTime->ObjectList); + ILibLinkedList_Destroy(UPnPLifeTime->DeleteList); UPnPLifeTime->ObjectCount = 0; UPnPLifeTime->ObjectList = NULL; }