summaryrefslogtreecommitdiffstats
path: root/generic/tclResult.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2011-03-08 15:14:18 (GMT)
committerdgp <dgp@users.sourceforge.net>2011-03-08 15:14:18 (GMT)
commit896ceaf5023cd32e741ee7f6895eaeedf6afef49 (patch)
tree87bbcd9961f419cb80469d1a59d7d0795318b56e /generic/tclResult.c
parent7b1f9159604d4005f984eb3f32a4be126e5a4834 (diff)
downloadtcl-896ceaf5023cd32e741ee7f6895eaeedf6afef49.zip
tcl-896ceaf5023cd32e741ee7f6895eaeedf6afef49.tar.gz
tcl-896ceaf5023cd32e741ee7f6895eaeedf6afef49.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 556903c..7b58d44 100644
--- a/generic/tclResult.c
+++ b/generic/tclResult.c
@@ -959,12 +959,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;
}