From bcc73fbc6af0549eb2b3c609d19e2b738d1a4e19 Mon Sep 17 00:00:00 2001 From: daniel-Jones Date: Mon, 2 Apr 2018 23:16:04 +0930 Subject: removed exit free()ing --- snake.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'snake.c') diff --git a/snake.c b/snake.c index ca7ed6b..ec7c64a 100644 --- a/snake.c +++ b/snake.c @@ -134,15 +134,6 @@ int main(void) /* end ncurses for a sane terminal */ endwin(); printf("final score: %d\n", snake->score); - /* free body pieces */ - piece *finger = snake->firstpiece; - while (finger != NULL) - { - free(finger->prev); - finger = finger->next; - } - free(snake->firstpiece); - free(finger); return 0; } @@ -247,7 +238,7 @@ void draw(head *snake, food *eat) mvwaddch(snake->area, finger->y, finger->x, ACS_BLOCK); finger = finger->next; } - free (finger); + free(finger); mvprintw(0, 0, "score: %d\n", snake->score); mvprintw(HEIGHT+2, 0, " 'wasd/hjkl' to control the snake.\n" \ " 'b' to toggle bot control.\n" \ -- cgit v1.2.3