title: Gtest and Gmock - double free or corruption
body: <p>I've wasted many hours to resolve this problem, but without success. At first, my configuration: Ubuntu 16.04.1, qmake 3.0, cmake 3.5.1, shared gtest and gmock libraries, version 1.8.0. I use Qt Creator, and this is a little example of minimal program that lead to the crush.</p>
  
  <p>main.cpp:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;gtest/gtest.h&gt;
  #include &lt;gmock/gmock.h&gt;
  
  using namespace std;
  
  class A {
      void print() {
          std::cout &lt;&lt; "PRINT" &lt;&lt; std::endl;
      }
  };
  
  class B: public A {
      MOCK_METHOD0(print, void());
  };
  
  TEST(MOCK, TEST) {
      B b;
  }
  
  int main(int argc, char *argv[])
  {
      ::testing::InitGoogleTest(&amp;argc, argv);
      return RUN_ALL_TESTS();
  }
  </code></pre>
  
  <p>google_test.pro:</p>
  
  <pre><code>TEMPLATE = app
  CONFIG += console c++11
  CONFIG -= app_bundle
  CONFIG -= qt
  
  SOURCES += main.cpp
  
  LIBS += -lgtest -lgmock
  </code></pre>
  
  <p>Tests are OK, but at the end of program I get this error:</p>
  
  <p><strong>* Error in `/home/aminought/QtProjects/build-google_test-Desktop_Qt_5_7_0_GCC_64bit-Debug/google_test': double free or corruption (!prev): 0x0000000001a51270 *</strong></p>
  
  <p>How to fix this error? Very annoying.</p>