summaryrefslogtreecommitdiffstats
path: root/generic/tclStringObj.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2016-10-13 16:56:23 (GMT)
committerdgp <dgp@users.sourceforge.net>2016-10-13 16:56:23 (GMT)
commite35292f3148b49b096a52e07789775a9e6e8baba (patch)
treec39ef5c763275e6a9d929d7ab59e5579ca1fdb1b /generic/tclStringObj.c
parent4dc1a8a58817ce403cd25a0f4b4ce2b2fa9ddd60 (diff)
parent7f0e6652c788c101f172165c6583409e725a7164 (diff)
downloadtcl-e35292f3148b49b096a52e07789775a9e6e8baba.zip
tcl-e35292f3148b49b096a52e07789775a9e6e8baba.tar.gz
tcl-e35292f3148b49b096a52e07789775a9e6e8baba.tar.bz2
Merge INST_STR_REPLACE fixes and improvements.
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 e3cede6..2930fa1 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -2948,6 +2948,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 {