xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 3635f65a65da6198d770d5148b68a81c271b9169
Author:     Caolán McNamara <[email protected]>
AuthorDate: Sat Nov 5 15:02:16 2022 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Sat Nov 5 21:00:53 2022 +0100

    fix a potential mem leak
    
    Change-Id: Ibc5f978b0db17e9e3fc633e843f476052570edfc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142332
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index 3aa9cab78a51..990ea86a9bbb 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -477,7 +477,10 @@ Reference< XCertificate > 
SecurityEnvironment_NssImpl::createCertificateFromAsci
     xmlSecSize certSize;
     int nRet = xmlSecBase64Decode_ex( chCert, 
reinterpret_cast<xmlSecByte*>(chCert), xmlStrlen( chCert ), &certSize ) ;
     if (nRet < 0 || certSize == 0)
+    {
+        xmlFree(chCert);
         return nullptr;
+    }
 
     Sequence< sal_Int8 > rawCert(comphelper::arrayToSequence<sal_Int8>(chCert, 
certSize)) ;
 
commit 5336952fc7fa6f8e1ae9652f59c87e29693694d4
Author:     Caolán McNamara <[email protected]>
AuthorDate: Sat Nov 5 15:01:08 2022 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Sat Nov 5 21:00:37 2022 +0100

    cid#1516654 Unchecked return value
    
    Change-Id: I19fcac7f1c4dff3bd18fe0cee0188e207edd4251
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142330
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index 97f2ce3b4ea7..3aa9cab78a51 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -475,8 +475,8 @@ Reference< XCertificate > 
SecurityEnvironment_NssImpl::createCertificateFromAsci
     OString oscert = OUStringToOString( asciiCertificate , 
RTL_TEXTENCODING_ASCII_US ) ;
     xmlChar* chCert = xmlStrndup( reinterpret_cast<const 
xmlChar*>(oscert.getStr()), static_cast<int>(oscert.getLength()) ) ;
     xmlSecSize certSize;
-    xmlSecBase64Decode_ex( chCert, reinterpret_cast<xmlSecByte*>(chCert), 
xmlStrlen( chCert ), &certSize ) ;
-    if (certSize == 0)
+    int nRet = xmlSecBase64Decode_ex( chCert, 
reinterpret_cast<xmlSecByte*>(chCert), xmlStrlen( chCert ), &certSize ) ;
+    if (nRet < 0 || certSize == 0)
         return nullptr;
 
     Sequence< sal_Int8 > rawCert(comphelper::arrayToSequence<sal_Int8>(chCert, 
certSize)) ;

Reply via email to