test on pointer before set to NULL
This commit is contained in:
1 parent
7b42e41b19
commit
3efa272882
1 file changed
+6
-3
@@ -64,12 +64,15 @@ bool game_equal(cgame g1, cgame g2) {
|
||||
void game_delete(game g) {
|
||||
for (int i = 0; i < DEFAULT_SIZE; i++) {
|
||||
free(g->tab_cell[i]);
|
||||
g->tab_cell[i] = NULL;
|
||||
if (g->tab_cell[i] != NULL)
|
||||
g->tab_cell[i] = NULL;
|
||||
}
|
||||
free(g->tab_cell);
|
||||
g->tab_cell = NULL;
|
||||
if (g->tab_cell != NULL)
|
||||
g->tab_cell = NULL;
|
||||
free(g);
|
||||
g = NULL;
|
||||
if (g != NULL)
|
||||
g = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user