aboutsummaryrefslogtreecommitdiff
path: root/node.c
diff options
context:
space:
mode:
authorTucker Evans <tuckerevans24@gmail.com>2019-08-03 17:45:09 -0400
committerTucker Evans <tuckerevans24@gmail.com>2019-08-03 17:45:09 -0400
commit8cd6be853b61798a5fd4114292c62bb9384497bc (patch)
treeb9751c73f4954e55ca39d6acbea30ca56a2af5cd /node.c
parent51c0c989e7beb784c772dd8328f51fb6443e751c (diff)
Fix double free error
Diffstat (limited to 'node.c')
-rw-r--r--node.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/node.c b/node.c
index fbbfd14..586ed52 100644
--- a/node.c
+++ b/node.c
@@ -47,7 +47,10 @@ node *n;
{
node *tmp;
- for(tmp = n; tmp; tmp = n = n->next) {
+ for(tmp = n; tmp;) {
+ n = tmp->next;
free(tmp);
+ tmp = NULL;
+ tmp = n;
}
}