summaryrefslogtreecommitdiffstats
path: root/generic/tclStringObj.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2016-10-13 16:43:05 (GMT)
committerdgp <dgp@users.sourceforge.net>2016-10-13 16:43:05 (GMT)
commit7634bdaef23c2ef4ad88dfc47077a6c1ec934e8d (patch)
treea65bf5c82a8f52d06cb1f4738862562c01a71f3c /generic/tclStringObj.c
parent9cb330963b0fdbb5970527acbd9eca75aadc56b5 (diff)
downloadtcl-7634bdaef23c2ef4ad88dfc47077a6c1ec934e8d.zip
tcl-7634bdaef23c2ef4ad88dfc47077a6c1ec934e8d.tar.gz
tcl-7634bdaef23c2ef4ad88dfc47077a6c1ec934e8d.tar.bz2
Stop invading the String internals to work around a bug. Fix it instead.
Diffstat (limited to 'generic/tclStringObj.c')
-rw-r--r--generic/tclStringObj.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 11a57e9..60b08ae 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -3025,6 +3025,16 @@ UpdateStringOfString(
{
String *stringPtr = GET_STRING(objPtr);
+ /*
+ * This routine is only called when we need to generate the
+ * string rep objPtr->bytes because it does not exist -- it is NULL.
+ * In that circumstance, any lingering claim about the size of
+ * memory pointed to by that NULL pointer is clearly bogus, and
+ * needs a reset.
+ */
+
+ stringPtr->allocated = 0;
+
if (stringPtr->numChars == 0) {
TclInitStringRep(objPtr, tclEmptyStringRep, 0);
} else {