title: Double free or corruption when using destructor
body: <p>In the following code when I add the the line which is specified with an arrow gives error: </p>
  
  <blockquote>
    <p>Error in `./a.out': double free or corruption (fasttop):
    0x00000000007a7030 <em>*</em> Aborted (core dumped)</p>
  </blockquote>
  
  <p>The code works if I do not use destructor. Any idea?</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;vector&gt;
  
  struct Element
  {
      int *vtx;
  
      ~Element ()
      {
          delete [] vtx;
      }
  };
  
  int main ()
  {
      Element *elm = new Element [2];
      elm[0].vtx = new int [2]; // &lt;----- adding this gives error
  
      std::vector &lt;Element&gt; vec;
      vec.push_back (elm[0]);
      vec.push_back (elm[0]);
  
      return 0;
  }
  </code></pre>