summaryrefslogtreecommitdiffstats
path: root/generic/tclResult.c
diff options
context:
space:
mode:
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;
}