aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2011-08-11 17:56:37 +0200
committerJay Berkenbilt <ejb@ql.org>2011-08-11 17:57:37 +0200
commit76b1659177327a64037bf36d7f3e15a73d86bbed (patch)
tree22623001bb99a6fe33943416877a3d5836b550d8 /libqpdf/QPDF.cc
parent14fe2e6de3ae3b91436ccb4948fca75c29565440 (diff)
downloadqpdf-76b1659177327a64037bf36d7f3e15a73d86bbed.tar.zst
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
Diffstat (limited to 'libqpdf/QPDF.cc')
-rw-r--r--libqpdf/QPDF.cc7
1 files changed, 3 insertions, 4 deletions
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<char> b(buf);
+ // Put buf in an array-style PointerHolder to guarantee deletion
+ // of buf.
+ PointerHolder<char> b(true, buf);
memset(buf, '\0', tbuf_size + 1);
this->file->read(buf, tbuf_size);