diff --git a/du7/snake.c b/du7/snake.c index 7c9c139..0b08096 100644 --- a/du7/snake.c +++ b/du7/snake.c @@ -16,14 +16,15 @@ struct snake* add_snake(struct snake* snake,int x,int y){ } struct snake* remove_snake(struct snake* snake){ - struct snake* nasledujuci = snake->next; + struct snake* nasledujuci = calloc(1, sizeof(struct snake)); + nasledujuci = snake->next; free(snake); return nasledujuci; } void free_snake(struct snake* sn){ - struct snake* nasledujuci; + struct snake* nasledujuci = calloc(1, sizeof(struct snake)); while (sn != NULL) { nasledujuci = sn->next;