Fix SEGV.

This commit is contained in:
Dianne Skoll
2024-06-01 09:27:27 -04:00
parent b78702cc53
commit 8dbae776c9
2 changed files with 6 additions and 3 deletions

View File

@@ -377,7 +377,7 @@ eval_userfunc(expr_node *node, Value *locals, Value *ans, int *nonconst)
for (j=0; j<node->num_kids; j++) {
DestroyValue(new_locals[j]);
}
if (new_locals != stack_locals) free(new_locals);
if (new_locals != NULL && new_locals != stack_locals) free(new_locals);
return E_RECURSIVE;
}
@@ -405,7 +405,10 @@ eval_userfunc(expr_node *node, Value *locals, Value *ans, int *nonconst)
for (j=0; j<node->num_kids; j++) {
DestroyValue(new_locals[j]);
}
if (new_locals != stack_locals) free(new_locals);
if (new_locals != stack_locals &&
new_locals != NULL) {
free(new_locals);
}
return r;
}

View File

@@ -1203,7 +1203,7 @@ static int FChoose(expr_node *node, Value *locals, Value *ans, int *nonconst)
int nargs = node->num_kids;
Value(v);
DBG(DBufInit(&DebugBuf));
PUT("choose(");
DBG(PUT("choose("));
cur = node->child;
r = evaluate_expr_node(cur, locals, &v, nonconst);