feat: squash another leak?

This commit is contained in:
NunoSempere 2023-05-02 20:59:09 -04:00
parent df64451be2
commit b961628a77
2 changed files with 13 additions and 2 deletions

BIN
mumble

Binary file not shown.

View File

@ -196,17 +196,28 @@ void delete_lispval(lispval* v)
case LISPVAL_QEXPR: case LISPVAL_QEXPR:
if (VERBOSE) if (VERBOSE)
printfln("Freeing sexpr|qexpr"); printfln("Freeing sexpr|qexpr");
if (v == NULL || v->count != 0) // if (v == NULL || v->count != 0)
return; // return;
if (VERBOSE)
printfln("Freed sexpr|qexpr cells");
for (int i = 0; i < v->count; i++) { for (int i = 0; i < v->count; i++) {
if (v->cell[i] != NULL) if (v->cell[i] != NULL)
delete_lispval(v->cell[i]); delete_lispval(v->cell[i]);
v->cell[i] = NULL; v->cell[i] = NULL;
} }
if (VERBOSE)
printfln("Setting v->count to 0");
v->count = 0; v->count = 0;
if (VERBOSE)
printfln("Freeing v->cell");
if (v->cell != NULL) if (v->cell != NULL)
free(v->cell); free(v->cell);
v->cell = NULL; v->cell = NULL;
if (VERBOSE)
printfln("Freeing the v pointer");
if (v != NULL) if (v != NULL)
free(v); free(v);
if (VERBOSE) if (VERBOSE)