From 2b8a0b6423f70bbccdf214d12896d4755b384c67 Mon Sep 17 00:00:00 2001 From: Jannis Voelker Date: Thu, 2 Jul 2020 15:25:54 +0200 Subject: Fix memory leak in the open62541 backend Replacing the config variables without freeing the associated memory results in a memory leak. Change-Id: I6c6c4babd3b77c7e756c7ac69ecaba2b2ad1150c Pick-to: 5.14 dev Reviewed-by: Frank Meerkoetter --- src/plugins/opcua/open62541/qopen62541backend.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/opcua/open62541/qopen62541backend.cpp b/src/plugins/opcua/open62541/qopen62541backend.cpp index 69469d8..f2952b9 100644 --- a/src/plugins/opcua/open62541/qopen62541backend.cpp +++ b/src/plugins/opcua/open62541/qopen62541backend.cpp @@ -867,6 +867,10 @@ void Open62541AsyncBackend::connectToEndpoint(const QOpcUaEndpointDescription &e UA_ClientConfig_setDefault(conf); } + UA_LocalizedText_clear(&conf->clientDescription.applicationName); + UA_String_clear(&conf->clientDescription.applicationUri); + UA_String_clear(&conf->clientDescription.productUri); + conf->clientContext = this; conf->stateCallback = &clientStateCallback; conf->clientDescription.applicationName = UA_LOCALIZEDTEXT_ALLOC("", identity.applicationName().toUtf8().constData()); -- cgit v1.2.3