ok i think here is the problem, for a function that i call a couple times, the variable declarations are:

Code:

double **ddmatrix(int nrl,int nrh,int ncl,int nch) //allocate/reallocate for matrix
{
int i;
double **m;
m=(double **) malloc((unsigned) (nrh-nrl+1)*sizeof(double*));
if (!m) fprintf(stderr, "allocation failure 1 in dmatrix()");
m -= nrl;
for(i=nrl;i<=nrh;i++) {
m[i]=(double *) malloc((unsigned) (nch-ncl+1)*sizeof(double));
if (!m[i]) fprintf(stderr, "allocation failure 2 in dmatrix()");
m[i] -= ncl;
}
return m;
}
void funccall()
double **sig;
sig=ddmatrix(0,M-1,0,numpa*numpa-1);
.......
}

i allocate with the ddmatrix function. Since it's a double array I need to free all the sig[i] from 0 to M-1 as well right? I'll try that then