feat: squash another memory leak?

This commit is contained in:
NunoSempere 2023-05-02 21:04:58 -04:00
parent b961628a77
commit beb6b21ea6
2 changed files with 5 additions and 1 deletions

BIN
mumble

Binary file not shown.

View File

@ -816,7 +816,11 @@ lispval* evaluate_lispval(lispval* l, lispenv* env)
printfln("Checking if this is a symbol"); printfln("Checking if this is a symbol");
if (l->type == LISPVAL_SYM) { if (l->type == LISPVAL_SYM) {
// Unclear how I want to structure this so as to not get memory errors. // Unclear how I want to structure this so as to not get memory errors.
return get_from_lispenv(l->sym, env); lispval* answer = get_from_lispenv(l->sym, env);
delete_lispval(l);
// fixes memory bug! I guess that if I just return get_from_lispenv,
// then it gets lost along the way? Not sure.
return answer;
} }
// Evaluate the children if needed // Evaluate the children if needed