title: Freeing malloc 2D matrix
body: <p>My program isn't deleting the arrays, always stops at the freeing point. My code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;conio.h&gt;
  #include &lt;stdlib.h&gt;
  int main(){
      int n, m;
      scanf("%d %d", &amp;n, &amp;m);
      int** t;
      t=(int**)malloc(n);
      for(int i=0; i&lt;n; i++){
          t[i]=(int*)malloc(m);
      }
      for (int i=0; i&lt;n; i++){
          for(int j=0; j&lt;m; j++){
              t[i][j] = rand() % 10;
              printf("%d ", t[i][j]);
          }
          printf("\n");
      }
      getch();
      for(int i=1; i&lt;n; i++){
          free (t[0]);
      }
      free (t);
      return 0;
  }
  </code></pre>