title: Should I use "free" on 2D array when I used realloc?
body: <p>I have 2D array declared like this:</p>
  <pre><code>int **array= NULL;
  </code></pre>
  <p>and then, somewhere in code I add elements like this:</p>
  <pre><code>int* tempArray1D = FuncThatReturnsIntStarArray();
  array= (int**)realloc(array, (arraySize+ 1) * sizeof(int*));
  *(array+size - 1) = tempArray1D;
  </code></pre>
  <p>If I want to delete one (last) element from 2D array, should I use free() and realloc on 1D array (int*) or realloac take care of all that.
  For example:</p>
  <pre><code>free(*(array+ size- 1));
  array= (int**)realloc(array, (size- 1) * sizeof(int*));
  </code></pre>
  <p>or just:</p>
  <pre><code>array= (int**)realloc(array, (size- 1) * sizeof(int*));
  </code></pre>
  <p>Example with free() cause some issues and im not sure if that way of avoiding memory leaks is correct and I have somewhere else in the code other bug, or it is just bad way of doing that.</p>