From a629092af73abcf815328540ec7b06b8366c7fdf Mon Sep 17 00:00:00 2001 From: gangatp Date: Fri, 8 Dec 2023 00:37:52 +0530 Subject: [PATCH] try mem leak linux fix --- .../NMR_ModelReaderNode_KeyStoreCEKParams.cpp | 9 ++++++--- .../NMR_ModelReaderNode_KeyStoreCipherValue.cpp | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Source/Model/Reader/SecureContent101/NMR_ModelReaderNode_KeyStoreCEKParams.cpp b/Source/Model/Reader/SecureContent101/NMR_ModelReaderNode_KeyStoreCEKParams.cpp index 23a75ee0f..5a02fdde6 100644 --- a/Source/Model/Reader/SecureContent101/NMR_ModelReaderNode_KeyStoreCEKParams.cpp +++ b/Source/Model/Reader/SecureContent101/NMR_ModelReaderNode_KeyStoreCEKParams.cpp @@ -113,17 +113,20 @@ namespace NMR { PModelReaderNode_StringValue pXMLNode = std::make_shared(m_pWarnings); pXMLNode->parseXML(pXMLReader); std::string result = base64_decode(pXMLNode->getValue()); - m_iv = std::vector(result.begin(), result.end()); + if(!result.empty()) + m_iv = std::vector(result.begin(), result.end()); } else if (strcmp(pChildName, XML_3MF_SECURE_CONTENT_TAG) == 0) { PModelReaderNode_StringValue pXMLNode = std::make_shared(m_pWarnings); pXMLNode->parseXML(pXMLReader); std::string result = base64_decode(pXMLNode->getValue()); - m_tag = std::vector(result.begin(), result.end()); + if (!result.empty()) + m_tag = std::vector(result.begin(), result.end()); } else if (strcmp(pChildName, XML_3MF_SECURE_CONTENT_AAD) == 0) { PModelReaderNode_StringValue pXMLNode = std::make_shared(m_pWarnings); pXMLNode->parseXML(pXMLReader); std::string result = base64_decode(pXMLNode->getValue()); - m_aad = std::vector(result.begin(), result.end()); + if (!result.empty()) + m_aad = std::vector(result.begin(), result.end()); } else { m_pWarnings->addWarning(NMR_ERROR_NAMESPACE_INVALID_ELEMENT, mrwInvalidOptionalValue); } diff --git a/Source/Model/Reader/SecureContent101/NMR_ModelReaderNode_KeyStoreCipherValue.cpp b/Source/Model/Reader/SecureContent101/NMR_ModelReaderNode_KeyStoreCipherValue.cpp index e7a61218d..6a4885111 100644 --- a/Source/Model/Reader/SecureContent101/NMR_ModelReaderNode_KeyStoreCipherValue.cpp +++ b/Source/Model/Reader/SecureContent101/NMR_ModelReaderNode_KeyStoreCipherValue.cpp @@ -73,7 +73,8 @@ namespace NMR { pNode->parseXML(pXMLReader); try { std::string result = base64_decode(pNode->getValue()); - m_sCipherValue = std::vector(result.begin(), result.end()); + if(!result.empty()) + m_sCipherValue = std::vector(result.begin(), result.end()); } catch (...) { // base64_decode throws an exception if the input is not valid base64