time + fix leak memories
This commit is contained in:
15
function.c
15
function.c
@@ -37,6 +37,17 @@ creatArea2D (const unsigned int N)
|
||||
return tab2d;
|
||||
}
|
||||
|
||||
void free2D(unsigned short int **tab, int N)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < N; ++i)
|
||||
{
|
||||
free(tab[i]);
|
||||
}
|
||||
free(tab);
|
||||
return;
|
||||
}
|
||||
|
||||
short int
|
||||
canIGoDirection (short int valueOfNCase, short int valueOfNPlusOneCase)
|
||||
{
|
||||
@@ -290,7 +301,7 @@ blockBox (unsigned short int **tab2d, vect box_coor)
|
||||
{
|
||||
int nbr_touch = 0;
|
||||
vect card[4] = { { 0, -1 }, { 1, 0 }, { 0, 1 }, { -1, 0 } };
|
||||
int *indice_card = NULL;
|
||||
int indice_card[4] = {0};
|
||||
int id_box = -1;
|
||||
int i;
|
||||
for (i = 0; i < 4; ++i)
|
||||
@@ -304,8 +315,6 @@ blockBox (unsigned short int **tab2d, vect box_coor)
|
||||
{
|
||||
id_box = nbr_touch -1;
|
||||
}
|
||||
|
||||
indice_card = realloc (indice_card, sizeof (int) * nbr_touch);
|
||||
indice_card[nbr_touch - 1] = i;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user