Freeing multiple buffers in destructor c++
<p>I've got an array of pointers as a member in my class.
I am using those pointers to allocate a certain number of buffers.</p>

<p>In the destructor I want to free this memory, but it seems like I am doing something wrong.</p>

<pre><code>   //In the Constructor
   for(int i = 0; i&lt; NUM_OF_BUFFERS; i++)
   {
      mBuffer[i] = new Uint8[BUFFERSIZE];
      memset(mBuffer[i], 0, BUFFERSIZE);
      mBufferState[i] = NULL;
   }



   //In the destructor
   for (int i = 0; i &lt; NUM_OF_BUFFERS; i++)
   {
      delete[] mBuffer[i];
   }
</code></pre>

<p>For some reason this doesn't seem to work.
If I am commenting those lines in the destructor out, the program runs fine, if I run it with those lines it seems to freeze.</p>
