summaryrefslogtreecommitdiffstats
path: root/generic/tclResult.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2011-03-08 15:22:38 (GMT)
committerdgp <dgp@users.sourceforge.net>2011-03-08 15:22:38 (GMT)
commit7c2e7295abcd68607e8eace67d048f546a83411d (patch)
tree1114a221e975d66928fed84192cc8f71a88b3dbb /generic/tclResult.c
parentfabd507cfed4bc840f78a7b98f16ecaaef6c4c65 (diff)
downloadtcl-7c2e7295abcd68607e8eace67d048f546a83411d.zip
tcl-7c2e7295abcd68607e8eace67d048f546a83411d.tar.gz
tcl-7c2e7295abcd68607e8eace67d048f546a83411d.tar.bz2
* generic/tclResult.c (ResetObjResult): Correct failure to clear
invalid intrep. Thanks to Colin McDonald. [Bug 3202905]
Diffstat (limited to 'generic/tclResult.c')
-rw-r--r--generic/tclResult.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/generic/tclResult.c b/generic/tclResult.c
index f60ae26..2a04f18 100644
--- a/generic/tclResult.c
+++ b/generic/tclResult.c
@@ -980,12 +980,14 @@ ResetObjResult(
TclNewObj(objResultPtr);
Tcl_IncrRefCount(objResultPtr);
iPtr->objResultPtr = objResultPtr;
- } else if (objResultPtr->bytes != tclEmptyStringRep) {
- if (objResultPtr->bytes != NULL) {
- ckfree((char *) objResultPtr->bytes);
+ } else {
+ if (objResultPtr->bytes != tclEmptyStringRep) {
+ if (objResultPtr->bytes) {
+ ckfree((char *) objResultPtr->bytes);
+ }
+ objResultPtr->bytes = tclEmptyStringRep;
+ objResultPtr->length = 0;
}
- objResultPtr->bytes = tclEmptyStringRep;
- objResultPtr->length = 0;
TclFreeIntRep(objResultPtr);
objResultPtr->typePtr = NULL;
}