remove small memory leak.

This commit is contained in:
NunoSempere 2023-05-01 19:57:11 -04:00
parent 289de06edf
commit fc26fdf0f0
2 changed files with 3 additions and 1 deletions

BIN
mumble

Binary file not shown.

View File

@ -223,11 +223,12 @@ lispval* pop_lispval(lispval* v, int i)
return r; return r;
} }
lispval* take_lispval(lispval* v, int i){ lispval* take_lispval(lispval* v, int i){ // Unneeded.
lispval* x = pop_lispval(v, i); lispval* x = pop_lispval(v, i);
delete_lispval(v); delete_lispval(v);
return x; return x;
} }
lispval* builtin_op(char* op, lispval* v){ lispval* builtin_op(char* op, lispval* v){
// For now, ensure all args are numbers // For now, ensure all args are numbers
for(int i=0; i<v->count; i++){ for(int i=0; i<v->count; i++){
@ -291,6 +292,7 @@ lispval* evaluate_lispval(lispval* l)
if(l->count >=2 && ( (l->cell[0])->type == LISPVAL_SYM)){ if(l->count >=2 && ( (l->cell[0])->type == LISPVAL_SYM)){
lispval* op = pop_lispval(l, 0); lispval* op = pop_lispval(l, 0);
lispval* result = builtin_op(op->sym, l); lispval* result = builtin_op(op->sym, l);
delete_lispval(op);
return result; return result;
} }
return l; return l;