summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaniel-Jones <daniel@danieljon.es>2018-04-03 22:52:01 +0930
committerdaniel-Jones <daniel@danieljon.es>2018-04-03 22:52:01 +0930
commit25052ce98bd30aef121021cf1585d4a42cab6dd6 (patch)
tree0599ece2b8d1af8be133c07593e63cb512964bd9
parentbcc73fbc6af0549eb2b3c609d19e2b738d1a4e19 (diff)
downloadsnake-25052ce98bd30aef121021cf1585d4a42cab6dd6.tar.gz
snake-25052ce98bd30aef121021cf1585d4a42cab6dd6.zip
removed uneeded free()'s
-rw-r--r--snake.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/snake.c b/snake.c
index ec7c64a..75cdaea 100644
--- a/snake.c
+++ b/snake.c
@@ -133,6 +133,7 @@ int main(void)
}
/* end ncurses for a sane terminal */
endwin();
+ pthread_cancel(updatethread);
printf("final score: %d\n", snake->score);
return 0;
}
@@ -210,7 +211,6 @@ void *update(head *snake)
}
finger = finger->next;
}
- free(finger);
/* check if the game should play itself */
if (snake->npc)
npc_logic(snake, &eat);
@@ -238,7 +238,6 @@ void draw(head *snake, food *eat)
mvwaddch(snake->area, finger->y, finger->x, ACS_BLOCK);
finger = finger->next;
}
- 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" \
@@ -264,7 +263,6 @@ void setup_food(head *snake, food *eat)
goto restart;
finger = finger->next;
}
- free(finger);
/* make sure the food is in bounds */
if (eat->x < 3 ||
eat->x > WIDTH-3)