float **tree0;
tree0 = (float**)malloc(255 * sizeof(float*));
for( i = 0; i < 255; i++)
tree0[i] = (float*)malloc(M * sizeof(float));
for(i = 0; i < 255; i++)
for( k = 0; k < M; k++)
tree0[i][k] = 2;
Should I just free it like this
free(tree0);
I am heap corruption errors somewhere and thought this might be the problem…
You need to call
free()as many times as you calledmalloc()and on the same addresses which was returned bymalloc(). So, You just do it the way you allocated it: