From a1bbc1ac05acbe4053d7f8fab4555437acbc9c5c Mon Sep 17 00:00:00 2001 From: hershey Date: Thu, 10 Jun 1999 19:14:54 +0000 Subject: fied a memory leak. purify nolonger complains. --- generic/tclUnicodeObj.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/generic/tclUnicodeObj.c b/generic/tclUnicodeObj.c index 315644d..1809b20 100644 --- a/generic/tclUnicodeObj.c +++ b/generic/tclUnicodeObj.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnicodeObj.c,v 1.5 1999/06/10 04:28:51 stanton Exp $ + * RCS: @(#) $Id: tclUnicodeObj.c,v 1.6 1999/06/10 19:14:54 hershey Exp $ */ #include @@ -640,7 +640,7 @@ DupUnicodeInternalRep(srcPtr, copyPtr) Tcl_Obj *copyPtr; /* Object with internal rep to set. */ { Unicode *srcUnicodePtr = GET_UNICODE(srcPtr); - Unicode *copyUnicodePtr; /*GET_UNICODE(copyPtr);*/ + Unicode *copyUnicodePtr; /* * If the src obj is a string of 1-byte Utf chars, then copy the @@ -649,7 +649,7 @@ DupUnicodeInternalRep(srcPtr, copyPtr) * internal rep, and invalidate the string rep of the new object. */ - if (AllSingleByteChars(srcPtr)) { + if (srcUnicodePtr->numChars == srcPtr->length) { copyUnicodePtr = (Unicode *) ckalloc(sizeof(Unicode)); copyUnicodePtr->allocated = 0; } else { @@ -664,6 +664,7 @@ DupUnicodeInternalRep(srcPtr, copyPtr) } copyUnicodePtr->numChars = srcUnicodePtr->numChars; SET_UNICODE(copyPtr, copyUnicodePtr); + copyPtr->typePtr = &tclUnicodeType; } /* -- cgit v0.12