Commit ff6971fb1cba7ff88eeb0538d3d6cf5268add05f

Authored by Jay Berkenbilt
1 parent 49825e5c

Call PointerHolder constructor properly (fixes #135)

Passed arguments to the constructor in the wrong order.
README.maintainer
@@ -17,6 +17,13 @@ Release Reminders @@ -17,6 +17,13 @@ Release Reminders
17 running a spelling checker over the source code to catch errors in 17 running a spelling checker over the source code to catch errors in
18 variable names, strings, and comments. Use ispell -p ispell-words. 18 variable names, strings, and comments. Use ispell -p ispell-words.
19 19
  20 + * Run tests with sanitize address enabled:
  21 +
  22 + ./configure CFLAGS="-fsanitize=address -g" \
  23 + CXXFLAGS="-fsanitize=address -g" \
  24 + LDFLAGS="-fsanitize=address" \
  25 + --enable-werror --disable-shared
  26 +
20 * Consider running tests with latest gcc and/or valgrind. To do 27 * Consider running tests with latest gcc and/or valgrind. To do
21 this, replace, build with debugging and without shared libraries. 28 this, replace, build with debugging and without shared libraries.
22 In build, create z and move each executable into z. Then create a 29 In build, create z and move each executable into z. Then create a
qpdf/qpdf.cc
@@ -2050,7 +2050,7 @@ int main(int argc, char* argv[]) @@ -2050,7 +2050,7 @@ int main(int argc, char* argv[])
2050 // deleted by using PointerHolder objects to back the pointers in 2050 // deleted by using PointerHolder objects to back the pointers in
2051 // argv. 2051 // argv.
2052 std::vector<PointerHolder<char> > new_argv; 2052 std::vector<PointerHolder<char> > new_argv;
2053 - new_argv.push_back(PointerHolder<char>(QUtil::copy_string(argv[0]), true)); 2053 + new_argv.push_back(PointerHolder<char>(true, QUtil::copy_string(argv[0])));
2054 for (int i = 1; i < argc; ++i) 2054 for (int i = 1; i < argc; ++i)
2055 { 2055 {
2056 if ((strlen(argv[i]) > 1) && (argv[i][0] == '@')) 2056 if ((strlen(argv[i]) > 1) && (argv[i][0] == '@'))
@@ -2060,10 +2060,10 @@ int main(int argc, char* argv[]) @@ -2060,10 +2060,10 @@ int main(int argc, char* argv[])
2060 else 2060 else
2061 { 2061 {
2062 new_argv.push_back( 2062 new_argv.push_back(
2063 - PointerHolder<char>(QUtil::copy_string(argv[i]), true)); 2063 + PointerHolder<char>(true, QUtil::copy_string(argv[i])));
2064 } 2064 }
2065 } 2065 }
2066 - PointerHolder<char*> argv_ph(new char*[1+new_argv.size()], true); 2066 + PointerHolder<char*> argv_ph(true, new char*[1+new_argv.size()]);
2067 argv = argv_ph.getPointer(); 2067 argv = argv_ph.getPointer();
2068 for (size_t i = 0; i < new_argv.size(); ++i) 2068 for (size_t i = 0; i < new_argv.size(); ++i)
2069 { 2069 {