added a missing free, possible future bug fix

This commit is contained in:
Aaro Koivukangas
2025-05-02 13:28:04 +03:00
parent d4c5b1f2f0
commit 823da643dc
2 changed files with 4 additions and 1 deletions
+1
View File
@@ -191,5 +191,6 @@ int expr_free(struct expr *e)
return SWITCH_NOT_MATCHED; return SWITCH_NOT_MATCHED;
} }
free(e);
return 0; return 0;
} }
+3 -1
View File
@@ -22,9 +22,11 @@ void program_free(struct expr *program)
{ {
struct expr *current = program; struct expr *current = program;
// TODO: Error checking
while (current != NULL) while (current != NULL)
{ {
struct expr *next = current->next;
expr_free(current); expr_free(current);
current = current->next; current = next;
} }
} }