summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-05-17 12:49:11 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-05-17 15:42:31 +0200
commitc781776f3c79bbe3175b1452d26c79ebb931a500 (patch)
tree07c58c747ebb9715f71c7a8dcb3dff03a7ea5721 /svl
parentd7d43cf460d66354a40ffa3b34c0f9efcd42d0be (diff)
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@collabora.co.uk>
Diffstat (limited to 'svl')
-rw-r--r--svl/source/crypto/cryptosign.cxx3
1 files changed, 3 insertions, 0 deletions
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