From af6540d032201956b9833f05b9a6219822379659 Mon Sep 17 00:00:00 2001 From: Michal Utlak Date: Tue, 9 Apr 2024 16:59:38 +0200 Subject: [PATCH] skuska --- cv9/snake.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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; }