title: Mismatch delete
body: <p>I have program which implements database of peoples and his companies. I have created dynamic array of pointer to class members instead of dynamic array of class members, cause copying is quicker with it.</p>
  
  <p>I have version which works but valgrind shows mismatch delete in destructor (delete db)</p>
  
  <pre><code>CCompany** db;
  
  ~CCompanyIndex ( void )
  {
      for(unsigned i=0;i&lt;len;i++)
      {
          /*cout&lt;&lt;"dealloc:"&lt;&lt;db[i]&lt;&lt;endl;*/
          delete db[i];
      }
      delete db;
  }
  
  CCompanyIndex ( void )
  {
      max=1000;
      len=0;
      db=new CCompany*[max];
  }
  </code></pre>
  
  <p>I use also to add</p>
  
  <pre><code>CCompany* newIt=new CCompany(oName,oAddr,cName,cAddr);
  </code></pre>
  
  <p>So I have tried following code which I consider correct previously</p>
  
  <pre><code>~CCompanyIndex ( void )
  {
      delete [] db;
  }
  </code></pre>
  
  <p>But then all memory allocated by adding method is not deallocated.</p>