Hi, I'm having a problem trying to free in an assigned array, I'm doing a program to rotate an array, after assigning I execute a function and then the free does not work, returning the double free error or corruption

```
cop = malloc (x * sizeof (long int *));
(int k = 0, k <x, k ++)
{
cop[k] = malloc (and * sizeof (long int *));
}
transfected (mat, COP, Lin, et al, theta variables);
(int i = 0; i <x; i ++)
{
free (COP[i]);
}
free (COP);
```

The function used is the following:

```
empty transferase (long mat ** int, long int ** policeman, long lin int, long, int col, Int theta much, much int var)
{
long int value;
// x * sin (theta * PI / 180) + and * cos (theta * PI / 180);
// x * cos (theta * PI / 180) - and * sin (theta * PI / 180);
(int i = 0; i <lin; i ++)
{
(int k = 0; k) < col; k++)
{
long int a = k*cos(theta*PI/180) - i*sin(theta*PI/180);
long int b = k*sin(theta*PI/180) + i*cos(theta*PI/180);
a += var;
cop[b][a] = mat[i][k];
if (a > 0)
{
cop[b][a-1] = mat[i][k];
}
}
}
}
```

This function relates the lin / col of one matrix and rotates to b / a of another (in the case, the matrix cop), x and y is the size of the matrix necessary for the image to be broken.

Theta = 90º as an example