add check to free

This commit is contained in:
Chris Cromer 2021-07-17 16:58:38 -04:00
parent 13d46e8c60
commit b1dc92ba92
1 changed files with 4 additions and 1 deletions

View File

@ -51,7 +51,10 @@ void loop() {
atexit(exit_cleanup);
char *cwd = get_working_directory();
set_array_list(variables, "PWD", cwd);
free(cwd);
if (cwd != NULL) {
free(cwd);
cwd = NULL;
}
while (1) {
print_input_line();