diff --git a/cv9/snake.c b/cv9/snake.c index 67c8963..7205579 100644 --- a/cv9/snake.c +++ b/cv9/snake.c @@ -13,12 +13,15 @@ struct snake* add_snake(struct snake* snake,int x,int y){ } struct snake* remove_snake(struct snake* snake){ - if (snake == NULL) { + if (snake == NULL) { return NULL; } - + struct snake* nova_hlavicka = snake->next; + free(snake); + + assert(nova_hlavicka == NULL || nova_hlavicka->next == NULL); return nova_hlavicka; }