diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-12-27 14:41:15 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-12-27 14:41:15 (GMT) |
commit | 20253b8c7d3f3c59314380703be48df859cdf9e6 (patch) | |
tree | 291afd92fb75aa7117ad7fb895bc76a93c0c978c /generic | |
parent | b59e26b4ebf4d75131241be768955f8ae29e498f (diff) | |
download | tcl-20253b8c7d3f3c59314380703be48df859cdf9e6.zip tcl-20253b8c7d3f3c59314380703be48df859cdf9e6.tar.gz tcl-20253b8c7d3f3c59314380703be48df859cdf9e6.tar.bz2 |
[Bug 3598580]: Tcl_ListObjReplace may release deleted elements too early
Tests!? Where are the tests!?!
They are in test listobj-11.1
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclListObj.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/generic/tclListObj.c b/generic/tclListObj.c index fffe6a2..b4af98a 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -655,6 +655,10 @@ Tcl_ListObjReplace(interp, listPtr, first, count, objc, objv) count = 0; } + for (i = 0; i < objc; i++) { + Tcl_IncrRefCount(objv[i]); + } + numRequired = (numElems - count + objc); if (numRequired <= listRepPtr->maxElemCount) { /* @@ -689,7 +693,6 @@ Tcl_ListObjReplace(interp, listPtr, first, count, objc, objv) for (i = 0, j = first; i < objc; i++, j++) { elemPtrs[j] = objv[i]; - Tcl_IncrRefCount(objv[i]); } /* @@ -745,7 +748,6 @@ Tcl_ListObjReplace(interp, listPtr, first, count, objc, objv) for (i = 0, j = first; i < objc; i++, j++) { newPtrs[j] = objv[i]; - Tcl_IncrRefCount(objv[i]); } listRepPtr->elemCount = numRequired; |