From 62dccc5c2a593ef63a9a47ba0935d5549cb06448 Mon Sep 17 00:00:00 2001 From: Andrey Kashcheev Date: Thu, 10 Sep 2026 10:16:14 +0200 Subject: [PATCH] Ensure X509 data is being freed set1 takes its own reference Relates-To: HERESDK-14623 Signed-off-by: Andrey Kashcheev --- olp-cpp-sdk-core/src/http/curl/NetworkCurl.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/olp-cpp-sdk-core/src/http/curl/NetworkCurl.cpp b/olp-cpp-sdk-core/src/http/curl/NetworkCurl.cpp index 8251c0896..3f873edd2 100644 --- a/olp-cpp-sdk-core/src/http/curl/NetworkCurl.cpp +++ b/olp-cpp-sdk-core/src/http/curl/NetworkCurl.cpp @@ -113,9 +113,11 @@ int Md5LookupGetBySubject(X509_LOOKUP* ctx, X509_LOOKUP_TYPE type, // Update return result auto* x509_data = X509_new(); X509_set_subject_name(x509_data, name); - X509_OBJECT_set1_X509(ret, x509_data); + // set1 takes its own reference; release ours to avoid a per-lookup leak. + const auto set_ret = X509_OBJECT_set1_X509(ret, x509_data); + X509_free(x509_data); - return 1; + return set_ret; } #endif