[Libreoffice-commits] core.git: svl/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Mon May 17 13:43:11 UTC 2021


 svl/source/crypto/cryptosign.cxx |    3 +++
 1 file changed, 3 insertions(+)

New commits:
commit c781776f3c79bbe3175b1452d26c79ebb931a500
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon May 17 12:49:11 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon May 17 15:42:31 2021 +0200

    dont leak NSS Arena in svl::crypto::Signing::Sign
    
    Change-Id: I0c94c4f6035c1346468bbe78e94faea0cc714da8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115699
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/svl/source/crypto/cryptosign.cxx b/svl/source/crypto/cryptosign.cxx
index f2dffc4d76b7..70696dafce50 100644
--- a/svl/source/crypto/cryptosign.cxx
+++ b/svl/source/crypto/cryptosign.cxx
@@ -21,6 +21,7 @@
 #include <comphelper/hash.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/random.hxx>
+#include <comphelper/scopeguard.hxx>
 #include <com/sun/star/security/XCertificate.hpp>
 #include <com/sun/star/uno/Sequence.hxx>
 #include <o3tl/char16_t2wchar_t.hxx>
@@ -1290,6 +1291,8 @@ bool Signing::Sign(OStringBuffer& rCMSHexBuffer)
     cms_output.data = nullptr;
     cms_output.len = 0;
     PLArenaPool *arena = PORT_NewArena(10000);
+    const ::comphelper::ScopeGuard aScopeGuard(
+        [&arena]() mutable { free(arena); } );
     NSSCMSEncoderContext *cms_ecx;
 
     // Possibly it would work to even just pass NULL for the password callback function and its


More information about the Libreoffice-commits mailing list