#include <gtest/gtest.h>

/**
 * A test case that leaks memory, to check that we can spot this in valgrind
 */
TEST(Leak, ThisTestLeaks) { EXPECT_TRUE(new int[45]); }

#ifndef __NO_MAIN__
int main(int argc, char **argv) {
  ::testing::InitGoogleTest(&argc, argv);
  return RUN_ALL_TESTS();
}
#endif
#include <gtest/gtest.h>

/**
 * A test case that leaks memory, to check that we can spot this in valgrind
 */
TEST(Leak, ThisTestLeaks) {
  int* temp = new int[45];
  int temp2 = *temp++;
  std::cout << temp2;
}

#ifndef __NO_MAIN__
int main(int argc, char** argv) {
  ::testing::InitGoogleTest(&argc, argv);
  return RUN_ALL_TESTS();
}
#endif

Fix the leak test (so that it keeps leaking).
Fix the leak test (so that it keeps leaking).

It appears that gcc 9 fixes the leak automatically, so valgrind doesn't
detect it. Now we actually use the leaky variable, which seems to do the
trick.

Signed-off-by: Patrick Vacek <a38520cbbe2e974bc8b7ea86877dd3c7115ca2d7@gmail.com>
