From 76b1659177327a64037bf36d7f3e15a73d86bbed Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Thu, 11 Aug 2011 11:56:37 -0400 Subject: enhance PointerHolder so that it can explicitly be told to use delete [] instead of delete, thus making it useful to run valgrind over qpdf during its test suite --- libqpdf/QPDF.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'libqpdf/QPDF.cc') diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc index d614efe5..d161aebc 100644 --- a/libqpdf/QPDF.cc +++ b/libqpdf/QPDF.cc @@ -403,10 +403,9 @@ QPDF::parse(char const* password) this->file->rewind(); } char* buf = new char[tbuf_size + 1]; - // Put buf in a PointerHolder to guarantee deletion of buf. This - // calls delete rather than delete [], but it's okay since buf is - // an array of fundamental types. - PointerHolder b(buf); + // Put buf in an array-style PointerHolder to guarantee deletion + // of buf. + PointerHolder b(true, buf); memset(buf, '\0', tbuf_size + 1); this->file->read(buf, tbuf_size); -- cgit v1.2.3-54-g00ecf