aboutsummaryrefslogtreecommitdiffstats
path: root/evaluator.c
diff options
context:
space:
mode:
authorhejl <hejl@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2004-03-08 18:45:52 +0000
committerhejl <hejl@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2004-03-08 18:45:52 +0000
commitf54facba617e2c6b22714e581e43fa8d0e45c4d9 (patch)
tree03ce56c3bf4a4fe386cc4acc8a15f20712a7afe4 /evaluator.c
parent96f97ca49625e33381abca737f13a5cace139f63 (diff)
downloadlcd4linux-f54facba617e2c6b22714e581e43fa8d0e45c4d9.tar.gz
[lcd4linux @ 2004-03-08 18:45:52 by hejl]
fixed segfault when using string concatenation git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@390 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'evaluator.c')
-rw-r--r--evaluator.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/evaluator.c b/evaluator.c
index 134e395..214de3e 100644
--- a/evaluator.c
+++ b/evaluator.c
@@ -1,4 +1,4 @@
-/* $Id: evaluator.c,v 1.16 2004/03/08 04:33:08 reinelt Exp $
+/* $Id: evaluator.c,v 1.17 2004/03/08 18:45:52 hejl Exp $
*
* expression evaluation
*
@@ -23,6 +23,9 @@
*
*
* $Log: evaluator.c,v $
+ * Revision 1.17 2004/03/08 18:45:52 hejl
+ * fixed segfault when using string concatenation
+ *
* Revision 1.16 2004/03/08 04:33:08 reinelt
* string concatenation fixed
*
@@ -991,7 +994,7 @@ static int EvalTree (NODE *Root)
i = Root->Children-1;
type = Root->Child[i]->Result->type;
number = Root->Child[i]->Result->number;
- string = Root->Child[i]->Result->string;
+ string = strdup(Root->Child[i]->Result->string);
break;
case O_SET: // variable assignment
@@ -999,14 +1002,14 @@ static int EvalTree (NODE *Root)
Root->Variable->value = DupResult (Root->Child[0]->Result);
type = Root->Child[0]->Result->type;
number = Root->Child[0]->Result->number;
- string = Root->Child[0]->Result->string;
+ string = strdup(Root->Child[0]->Result->string);
break;
case O_CND: // conditional expression
i = 1+(R2N(Root->Child[0]->Result) == 0.0);
type = Root->Child[i]->Result->type;
number = Root->Child[i]->Result->number;
- string = Root->Child[i]->Result->string;
+ string = strdup(Root->Child[i]->Result->string);
break;
case O_OR: // logical OR