diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclExecute.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 578be7e..15a5c7a 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclExecute.c,v 1.94.2.3 2003/06/10 19:58:35 msofer Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.94.2.4 2003/08/05 16:19:54 msofer Exp $ */ #include "tclInt.h" @@ -1425,7 +1425,16 @@ TclExecuteByteCode(interp, codePtr) objc, cmdNameBuf), Tcl_GetObjResult(interp)); objResultPtr = Tcl_GetObjResult(interp); - NEXT_INST_V(pcAdjustment, opnd, 1); + + /* + * Reset the interp's result to avoid possible duplications + * of large objects [Bug 781585]; be careful to increase its + * refCount before resetting the result. + */ + + Tcl_IncrRefCount(objResultPtr); + Tcl_ResetResult(interp); + NEXT_INST_V(pcAdjustment, opnd, -1); } else { cleanup = opnd; goto processExceptionReturn; @@ -1451,7 +1460,16 @@ TclExecuteByteCode(interp, codePtr) objResultPtr = Tcl_GetObjResult(interp); TRACE_WITH_OBJ(("\"%.30s\" => ", O2S(objPtr)), Tcl_GetObjResult(interp)); - NEXT_INST_F(1, 1, 1); + + /* + * Reset the interp's result to avoid possible duplications + * of large objects [Bug 781585]; be careful to increase its + * refCount before resetting the result. + */ + + Tcl_IncrRefCount(objResultPtr); + Tcl_ResetResult(interp); + NEXT_INST_F(1, 1, -1); } else { cleanup = 1; goto processExceptionReturn; @@ -3931,7 +3949,15 @@ TclExecuteByteCode(interp, codePtr) case INST_PUSH_RESULT: objResultPtr = Tcl_GetObjResult(interp); TRACE_WITH_OBJ(("=> "), Tcl_GetObjResult(interp)); - NEXT_INST_F(1, 0, 1); + /* + * Reset the interp's result to avoid possible duplications + * of large objects [Bug 781585]; be careful to increase its + * refCount before resetting the result. + */ + + Tcl_IncrRefCount(objResultPtr); + Tcl_ResetResult(interp); + NEXT_INST_F(1, 0, -1); case INST_PUSH_RETURN_CODE: objResultPtr = Tcl_NewLongObj(result); |