solve bug #1 when deleting lispval

This commit is contained in:
NunoSempere 2023-05-07 22:17:38 -04:00
parent 140788b8ed
commit 789a48ccbc
2 changed files with 8 additions and 6 deletions

BIN
mumble

Binary file not shown.

View File

@ -251,16 +251,16 @@ void delete_lispval(lispval* v)
case LISPVAL_USER_FUNC: case LISPVAL_USER_FUNC:
if(VERBOSE) printfln("This shouldn't fire until the end, unless we are deleting the operands of a builtin function. E.g,. in def {id} (@ {x} {x}), there is a lambda function in the arguments, which should get collected."); if(VERBOSE) printfln("This shouldn't fire until the end, unless we are deleting the operands of a builtin function. E.g,. in def {id} (@ {x} {x}), there is a lambda function in the arguments, which should get collected.");
// for now, do nothing // for now, do nothing
/*
if (VERBOSE) if (VERBOSE)
printfln("Freeing user-defined func"); printfln("Freeing user-defined func");
if (v->env != NULL) { if (v->env != NULL) {
// destroy_lispenv(v->env); destroy_lispenv(v->env);
// free(v->env); // ^ free(v->env) is not necessary; taken care of by destroy_lispenv
//v->env = NULL; v->env = NULL;
} }
if (v->variables != NULL) { if (v->variables != NULL) {
// delete_lispval(v->variables); // delete_lispval(v->variables);
// free(v->variables)
// v->variables = NULL; // v->variables = NULL;
} }
if (v->manipulation != NULL) { if (v->manipulation != NULL) {
@ -269,12 +269,14 @@ void delete_lispval(lispval* v)
// v->manipulation = NULL; // v->manipulation = NULL;
} }
if (v != NULL) if (v != NULL)
// free(v); free(v);
if (VERBOSE) if (VERBOSE)
printfln("Freed user-defined func"); printfln("Freed user-defined func");
// Don't do anything with v->func for now // Don't do anything with v->func for now
// Though we could delete the pointer to the function later // Though we could delete the pointer to the function later
//
// free(v->func); // free(v->func);
/*
*/ */
break; break;
case LISPVAL_SEXPR: case LISPVAL_SEXPR: