diff options
author | dgp <dgp@users.sourceforge.net> | 2016-10-13 16:43:05 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2016-10-13 16:43:05 (GMT) |
commit | dca9bb39489c9c228b3c1ccc6019e3cee3699c7a (patch) | |
tree | a65bf5c82a8f52d06cb1f4738862562c01a71f3c /generic/tclStringObj.c | |
parent | 61df5f46580699c45d9263e3e98a0cf3f2006672 (diff) | |
download | tcl-dca9bb39489c9c228b3c1ccc6019e3cee3699c7a.zip tcl-dca9bb39489c9c228b3c1ccc6019e3cee3699c7a.tar.gz tcl-dca9bb39489c9c228b3c1ccc6019e3cee3699c7a.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.c | 10 |
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 { |