I declare a two-dimensional array a(m\*n) in a `for` loop. When the `for` loop runs for the first time there is no problem, but the second time it generates an error. The program is:

```
for (int j=0; j<2; j++) {
    int **a = (int**)calloc(n,sizeof(int*));
    for (int i=0; i<n; i++) {
        a[i] = (int*)calloc(m,sizeof(int));
    }
    //...some operation to a[m,n] array
    for (int i=0; i<n; i++)
        free(a[i]);
    free(a);
}

```

When the `for` loop runs for the second time, it runs to the line containing `calloc` and generates the following error on the console:

> 
> malloc: \*\*\* error for object 0x94a8b14: incorrect checksum for freed 
>  object - object was probably modified after being freed
> 
> 
> 

It makes no difference if I delete the lines containing `free`.