diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-09-05 15:17:08 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-09-05 15:41:50 +0200 |
commit | d73c039fa5353f0b96026bed4a0da31d9a41d2c7 (patch) | |
tree | ddc278d5d52959102a3972f734da79c6aaab1eb1 /vcl | |
parent | faf66519cf92d7998a29b31a93d49780b8dfa28e (diff) |
CID#1078782: fix memory leak
Change-Id: I4a98e68b5f74de787e28925e2e55de96f1cb980e
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 57237b7f3c82..d2d3e7e446dc 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -5993,7 +5993,7 @@ bool PDFWriterImpl::finalizeSignature() // Prepare buffer and calculate PDF file digest CHECK_RETURN( (osl_File_E_None == osl_setFilePos( m_aFile, osl_Pos_Absolut, 0) ) ); - HASHContext *hc = HASH_Create(HASH_AlgSHA1); + boost::scoped_ptr<HASHContext> hc(HASH_Create(HASH_AlgSHA1)); if (!hc) { @@ -6001,7 +6001,7 @@ bool PDFWriterImpl::finalizeSignature() return false; } - HASH_Begin(hc); + HASH_Begin(hc.get()); char *buffer = new char[m_nSignatureContentOffset + 1]; sal_uInt64 bytesRead; @@ -6012,7 +6012,7 @@ bool PDFWriterImpl::finalizeSignature() if (bytesRead != (sal_uInt64)m_nSignatureContentOffset - 1) SAL_WARN("vcl.gdi", "PDF Signing: First buffer read failed!"); - HASH_Update(hc, reinterpret_cast<const unsigned char*>(buffer), bytesRead); + HASH_Update(hc.get(), reinterpret_cast<const unsigned char*>(buffer), bytesRead); delete[] buffer; CHECK_RETURN( (osl_File_E_None == osl_setFilePos( m_aFile, osl_Pos_Absolut, m_nSignatureContentOffset + MAX_SIGNATURE_CONTENT_LENGTH + 1) ) ); @@ -6021,14 +6021,14 @@ bool PDFWriterImpl::finalizeSignature() if (bytesRead != (sal_uInt64) nLastByteRangeNo) SAL_WARN("vcl.gdi", "PDF Signing: Second buffer read failed!"); - HASH_Update(hc, reinterpret_cast<const unsigned char*>(buffer), bytesRead); + HASH_Update(hc.get(), reinterpret_cast<const unsigned char*>(buffer), bytesRead); delete[] buffer; SECItem digest; unsigned char hash[SHA1_LENGTH]; digest.data = hash; - HASH_End(hc, digest.data, &digest.len, SHA1_LENGTH); - HASH_Destroy(hc); + HASH_End(hc.get(), digest.data, &digest.len, SHA1_LENGTH); + HASH_Destroy(hc.get()); const char *pass = OUStringToOString( m_aContext.SignPassword, RTL_TEXTENCODING_UTF8 ).getStr(); |