title: How to free double pointers after usage in c?
body: <pre><code>float **tree0;
  
  tree0 = (float**)malloc(255 * sizeof(float*));
  
  for( i = 0; i &lt; 255; i++) 
      tree0[i] = (float*)malloc(M * sizeof(float));
  for(i = 0; i &lt; 255; i++)
      for( k = 0; k &lt; M; k++)
          tree0[i][k] = 2;
  </code></pre>
  
  <p>Should I just free it like this</p>
  
  <pre><code>free(tree0);
  </code></pre>
  
  <p>I am heap corruption errors somewhere and thought this might be the problem...</p>