aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF_encryption.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-02-05 14:15:07 +0100
committerJay Berkenbilt <ejb@ql.org>2022-02-05 17:24:56 +0100
commit5f3f78822b5d43e9b02082da5268d186ba7101c0 (patch)
treec7d2407df01e4c622371ad290f9681a5ae99a476 /libqpdf/QPDF_encryption.cc
parent88c3d556d552a94aa42eaa2fa43667952e123dc8 (diff)
downloadqpdf-5f3f78822b5d43e9b02082da5268d186ba7101c0.tar.zst
Improve use of std::unique_ptr
* Use unique_ptr in place of shared_ptr in some cases * unique_ptr for arrays does not require a custom deleter * use std::make_unique (c++14) where possible
Diffstat (limited to 'libqpdf/QPDF_encryption.cc')
-rw-r--r--libqpdf/QPDF_encryption.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/libqpdf/QPDF_encryption.cc b/libqpdf/QPDF_encryption.cc
index 54c2dadc..5ce63e4c 100644
--- a/libqpdf/QPDF_encryption.cc
+++ b/libqpdf/QPDF_encryption.cc
@@ -1211,7 +1211,7 @@ QPDF::decryptString(std::string& str, int objid, int generation)
size_t vlen = str.length();
// Using PointerHolder guarantees that tmp will
// be freed even if rc4.process throws an exception.
- auto tmp = QUtil::make_shared_cstr(str);
+ auto tmp = QUtil::make_unique_cstr(str);
RC4 rc4(QUtil::unsigned_char_pointer(key), toI(key.length()));
rc4.process(QUtil::unsigned_char_pointer(tmp.get()), vlen);
str = std::string(tmp.get(), vlen);