summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJannis Voelker <jannis.voelker@basyskom.com>2020-07-02 15:25:54 +0200
committerJannis Voelker <jannis.voelker@basyskom.com>2020-07-02 15:45:27 +0200
commit2b8a0b6423f70bbccdf214d12896d4755b384c67 (patch)
tree72867b8159c147f6255dc57742cefcc49bafc368
parent2738f4a085452d2ca02f13bfaf41aebbf502108c (diff)
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 <frank.meerkoetter@basyskom.com>
-rw-r--r--src/plugins/opcua/open62541/qopen62541backend.cpp4
1 files changed, 4 insertions, 0 deletions
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());