diff options
author | hershey <hershey> | 1999-06-16 00:47:56 (GMT) |
---|---|---|
committer | hershey <hershey> | 1999-06-16 00:47:56 (GMT) |
commit | 3b0e43889ac4f69b3d563e91c5cadd5371853d41 (patch) | |
tree | 7c2dad22f90b5f5021a37c7c768c77815259332e /generic | |
parent | 51f2d76280e4152cd3313ecea349790f04a0ec60 (diff) | |
download | tcl-3b0e43889ac4f69b3d563e91c5cadd5371853d41.zip tcl-3b0e43889ac4f69b3d563e91c5cadd5371853d41.tar.gz tcl-3b0e43889ac4f69b3d563e91c5cadd5371853d41.tar.bz2 |
fixed bug that cause bad memory read on Windows
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclStringObj.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 24881d6..95e83dc 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -33,7 +33,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclStringObj.c,v 1.11 1999/06/16 00:00:48 hershey Exp $ */ + * RCS: @(#) $Id: tclStringObj.c,v 1.12 1999/06/16 00:47:56 hershey Exp $ */ #include "tclInt.h" @@ -1370,8 +1370,8 @@ DupStringInternalRep(srcPtr, copyPtr) * not currently have an internal rep.*/ { String *srcStringPtr = GET_STRING(srcPtr); - String *copyStringPtr; - + String *copyStringPtr = NULL; + /* * If the src obj is a string of 1-byte Utf chars, then copy the * string rep of the source object and create an "empty" Unicode @@ -1379,8 +1379,8 @@ DupStringInternalRep(srcPtr, copyPtr) * internal rep, and invalidate the string rep of the new object. */ - if (srcStringPtr->numChars == srcPtr->length) { - copyStringPtr = (String *) ckalloc(sizeof(String)); + if (srcStringPtr->uallocated == 0) { + copyStringPtr = (String *) ckalloc(sizeof(String)); copyStringPtr->uallocated = 0; } else { copyStringPtr = (String *) ckalloc( |