From 6c39aa87638f7a6f96a97627ac112fb2022bd3a7 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sat, 22 Jun 2019 14:24:49 -0400 Subject: In shippable code, favor smart pointers (fixes #235) Use PointerHolder in several places where manually memory allocation and deallocation were being used. This helps to protect against memory leaks when exceptions are thrown in surprising places. --- include/qpdf/ClosedFileInputSource.hh | 2 +- include/qpdf/Pl_Flate.hh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/qpdf/ClosedFileInputSource.hh b/include/qpdf/ClosedFileInputSource.hh index ee8557fc..09b63bbd 100644 --- a/include/qpdf/ClosedFileInputSource.hh +++ b/include/qpdf/ClosedFileInputSource.hh @@ -82,7 +82,7 @@ class ClosedFileInputSource: public InputSource std::string filename; qpdf_offset_t offset; - FileInputSource* fis; + PointerHolder fis; bool stay_open; }; PointerHolder m; diff --git a/include/qpdf/Pl_Flate.hh b/include/qpdf/Pl_Flate.hh index 2884ecc5..f25adfbb 100644 --- a/include/qpdf/Pl_Flate.hh +++ b/include/qpdf/Pl_Flate.hh @@ -58,7 +58,7 @@ class Pl_Flate: public Pipeline Members(size_t out_bufsize, action_e action); Members(Members const&); - unsigned char* outbuf; + PointerHolder outbuf; size_t out_bufsize; action_e action; bool initialized; -- cgit v1.2.3-54-g00ecf