summaryrefslogtreecommitdiff
path: root/snake.c
diff options
context:
space:
mode:
authordaniel-Jones <daniel@danieljon.es>2018-04-02 23:16:04 +0930
committerdaniel-Jones <daniel@danieljon.es>2018-04-02 23:16:04 +0930
commitbcc73fbc6af0549eb2b3c609d19e2b738d1a4e19 (patch)
tree8155c205458758ac9f77dbfeb9adddb41e671b6b /snake.c
parent9028e3082e0ed32b1fb6ac86e967e12c1f7a6f95 (diff)
downloadsnake-bcc73fbc6af0549eb2b3c609d19e2b738d1a4e19.tar.gz
snake-bcc73fbc6af0549eb2b3c609d19e2b738d1a4e19.zip
removed exit free()ing
Diffstat (limited to 'snake.c')
-rw-r--r--snake.c11
1 files changed, 1 insertions, 10 deletions
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" \