2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-23 03:18:59 +00:00

Call PointerHolder constructor properly (fixes #135)

Passed arguments to the constructor in the wrong order.
This commit is contained in:
Jay Berkenbilt 2017-08-09 21:48:01 -04:00
parent 49825e5cb6
commit ff6971fb1c
2 changed files with 10 additions and 3 deletions

View File

@ -17,6 +17,13 @@ Release Reminders
running a spelling checker over the source code to catch errors in running a spelling checker over the source code to catch errors in
variable names, strings, and comments. Use ispell -p ispell-words. variable names, strings, and comments. Use ispell -p ispell-words.
* Run tests with sanitize address enabled:
./configure CFLAGS="-fsanitize=address -g" \
CXXFLAGS="-fsanitize=address -g" \
LDFLAGS="-fsanitize=address" \
--enable-werror --disable-shared
* Consider running tests with latest gcc and/or valgrind. To do * Consider running tests with latest gcc and/or valgrind. To do
this, replace, build with debugging and without shared libraries. this, replace, build with debugging and without shared libraries.
In build, create z and move each executable into z. Then create a In build, create z and move each executable into z. Then create a

View File

@ -2050,7 +2050,7 @@ int main(int argc, char* argv[])
// deleted by using PointerHolder objects to back the pointers in // deleted by using PointerHolder objects to back the pointers in
// argv. // argv.
std::vector<PointerHolder<char> > new_argv; std::vector<PointerHolder<char> > new_argv;
new_argv.push_back(PointerHolder<char>(QUtil::copy_string(argv[0]), true)); new_argv.push_back(PointerHolder<char>(true, QUtil::copy_string(argv[0])));
for (int i = 1; i < argc; ++i) for (int i = 1; i < argc; ++i)
{ {
if ((strlen(argv[i]) > 1) && (argv[i][0] == '@')) if ((strlen(argv[i]) > 1) && (argv[i][0] == '@'))
@ -2060,10 +2060,10 @@ int main(int argc, char* argv[])
else else
{ {
new_argv.push_back( new_argv.push_back(
PointerHolder<char>(QUtil::copy_string(argv[i]), true)); PointerHolder<char>(true, QUtil::copy_string(argv[i])));
} }
} }
PointerHolder<char*> argv_ph(new char*[1+new_argv.size()], true); PointerHolder<char*> argv_ph(true, new char*[1+new_argv.size()]);
argv = argv_ph.getPointer(); argv = argv_ph.getPointer();
for (size_t i = 0; i < new_argv.size(); ++i) for (size_t i = 0; i < new_argv.size(); ++i)
{ {