Commit Diff


commit - e599ffc44d8133fb9bea8e8eb0d39e86079a264f
commit + 3a74f37a76c24875468a69225846754d61b0064f
blob - f2e488f1a68deae8eed6c474c8bf08c28212e1cd
blob + 858d71637a9ab8b22dd2505d38c7008283399186
--- script.c
+++ script.c
@@ -225,9 +225,13 @@ global_set(char *sym, struct op *op)
 	b->name = sym;
 
 	/* it's only a cast on a literal! */
-	if (op->type == OP_CAST && eval(op) != EVAL_OK)
-		return 0;
-	else
+	if (op->type == OP_CAST) {
+		if (eval(op) != EVAL_OK) {
+			free(b);
+			return 0;
+		}
+		popv(&b->val);
+	} else
 		memcpy(&b->val, &op->v.literal, sizeof(b->val));
 
 	e = TAILQ_LAST(&envs, envs);