summaryrefslogtreecommitdiffstats
path: root/generic/tclExecute.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-09-11 13:43:49 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-09-11 13:43:49 (GMT)
commit6e44927248852ae0356d9d3e1cfa3d69597a66b1 (patch)
treebbc02e81071580c880556d9262cb0737c5e85b13 /generic/tclExecute.c
parent7f62b768876fc8b0779d10ae3fcba1fc7aeaba04 (diff)
downloadtcl-6e44927248852ae0356d9d3e1cfa3d69597a66b1.zip
tcl-6e44927248852ae0356d9d3e1cfa3d69597a66b1.tar.gz
tcl-6e44927248852ae0356d9d3e1cfa3d69597a66b1.tar.bz2
Folow-up to previous commit: ExecStack is a FLEXARRAY too
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r--generic/tclExecute.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index aacf565..4d92468 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -914,8 +914,8 @@ TclCreateExecEnv(
* [sizeof(Tcl_Obj*)] */
{
ExecEnv *eePtr = ckalloc(sizeof(ExecEnv));
- ExecStack *esPtr = ckalloc(sizeof(ExecStack)
- + (size_t) (size-1) * sizeof(Tcl_Obj *));
+ ExecStack *esPtr = ckalloc(TclOffset(ExecStack, stackWords)
+ + size * sizeof(Tcl_Obj *));
eePtr->execStackPtr = esPtr;
TclNewBooleanObj(eePtr->constants[0], 0);
@@ -1180,7 +1180,7 @@ GrowEvaluationStack(
newElems = needed;
#endif
- newBytes = sizeof(ExecStack) + (newElems-1) * sizeof(Tcl_Obj *);
+ newBytes = TclOffset(ExecStack, stackWords) + newElems * sizeof(Tcl_Obj *);
oldPtr = esPtr;
esPtr = ckalloc(newBytes);