diff options
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 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 { |
