diff --git a/cv9/snake.c b/cv9/snake.c index b5a963d..5549d4d 100644 --- a/cv9/snake.c +++ b/cv9/snake.c @@ -32,6 +32,11 @@ struct snake* remove_snake(struct snake* snake){ } void free_snake(struct snake* sn){ + if (sn == NULL) { + return; + } + free_snake(sn->next); + free(sn); } int is_snake(struct snake* snake,int x,int y){