diff options
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r-- | generic/tclExecute.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c index b04a5c5..875601e 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -797,8 +797,8 @@ TclCreateExecEnv( * [sizeof(Tcl_Obj*)] */ { ExecEnv *eePtr = (ExecEnv *)Tcl_Alloc(sizeof(ExecEnv)); - ExecStack *esPtr = (ExecStack *)Tcl_Alloc(sizeof(ExecStack) - + (size-1) * sizeof(Tcl_Obj *)); + ExecStack *esPtr = (ExecStack *)Tcl_Alloc(offsetof(ExecStack, stackWords) + + size * sizeof(Tcl_Obj *)); eePtr->execStackPtr = esPtr; TclNewIntObj(eePtr->constants[0], 0); @@ -1063,7 +1063,7 @@ GrowEvaluationStack( newElems = needed; #endif - newBytes = sizeof(ExecStack) + (newElems-1) * sizeof(Tcl_Obj *); + newBytes = offsetof(ExecStack, stackWords) + newElems * sizeof(Tcl_Obj *); oldPtr = esPtr; esPtr = (ExecStack *)Tcl_Alloc(newBytes); |