Commit 021db6f226191e536a84ba6a76590bf5743d5d62
1 parent
1a8c2eb9
QPDFJob: convert password to shared pointer
Showing
3 changed files
with
4 additions
and
7 deletions
include/qpdf/QPDFJob.hh
| ... | ... | @@ -199,8 +199,7 @@ class QPDFJob |
| 199 | 199 | |
| 200 | 200 | enum remove_unref_e { re_auto, re_yes, re_no }; |
| 201 | 201 | |
| 202 | - char const* password; | |
| 203 | - std::shared_ptr<char> password_alloc; | |
| 202 | + std::shared_ptr<char> password; | |
| 204 | 203 | bool linearize; |
| 205 | 204 | bool decrypt; |
| 206 | 205 | int split_pages; | ... | ... |
libqpdf/QPDFJob.cc
libqpdf/QPDFJob_argv.cc
| ... | ... | @@ -178,7 +178,7 @@ ArgParser::argShowCrypto() |
| 178 | 178 | void |
| 179 | 179 | ArgParser::argPassword(char* parameter) |
| 180 | 180 | { |
| 181 | - o.password = parameter; | |
| 181 | + o.password = QUtil::make_shared_cstr(parameter); | |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | void |
| ... | ... | @@ -197,9 +197,7 @@ ArgParser::argPasswordFile(char* parameter) |
| 197 | 197 | } |
| 198 | 198 | if (lines.size() >= 1) |
| 199 | 199 | { |
| 200 | - // Make sure the memory for this stays in scope. | |
| 201 | - o.password_alloc = QUtil::make_shared_cstr(lines.front()); | |
| 202 | - o.password = o.password_alloc.get(); | |
| 200 | + o.password = QUtil::make_shared_cstr(lines.front()); | |
| 203 | 201 | |
| 204 | 202 | if (lines.size() > 1) |
| 205 | 203 | { | ... | ... |