From 31597e659d7ed47cae7a3637544fc8810a12109e Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 30 Sep 2009 03:11:24 +0000 Subject: * generic/tclDictObj.c: Updated freeIntRepProc routines so * generic/tclExecute.c: that they set the typePtr field to * generic/tclIO.c: NULL so that the Tcl_Obj is not left * generic/tclIndexObj.c: in an inconsistent state. * generic/tclInt.h: [Bug 2857044] * generic/tclListObj.c: * generic/tclNamesp.c: * generic/tclOOCall.c: * generic/tclObj.c: * generic/tclPathObj.c: * generic/tclProc.c: * generic/tclRegexp.c: * generic/tclStringObj.c: --- ChangeLog | 14 ++++++++++++++ generic/tclDictObj.c | 3 ++- generic/tclExecute.c | 5 ++--- generic/tclIO.c | 3 ++- generic/tclIndexObj.c | 3 ++- generic/tclInt.h | 3 ++- generic/tclListObj.c | 3 ++- generic/tclNamesp.c | 4 +++- generic/tclOOCall.c | 8 +++----- generic/tclObj.c | 4 +++- generic/tclPathObj.c | 3 ++- generic/tclProc.c | 3 ++- generic/tclRegexp.c | 3 ++- generic/tclStringObj.c | 3 ++- 14 files changed, 43 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5fcf4a7..1d0b2f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ 2009-09-29 Don Porter + * generic/tclDictObj.c: Updated freeIntRepProc routines so + * generic/tclExecute.c: that they set the typePtr field to + * generic/tclIO.c: NULL so that the Tcl_Obj is not left + * generic/tclIndexObj.c: in an inconsistent state. + * generic/tclInt.h: [Bug 2857044] + * generic/tclListObj.c: + * generic/tclNamesp.c: + * generic/tclOOCall.c: + * generic/tclObj.c: + * generic/tclPathObj.c: + * generic/tclProc.c: + * generic/tclRegexp.c: + * generic/tclStringObj.c: + * generic/tclAlloc.c: Cleaned up various routines in the * generic/tclCkalloc.c: call stacks for memory allocation to * generic/tclInt.h: guarantee that any size values computed diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index ef0ebe9..d30a769 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.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: tclDictObj.c,v 1.77 2009/02/03 23:34:32 nijtmans Exp $ + * RCS: @(#) $Id: tclDictObj.c,v 1.78 2009/09/30 03:11:24 dgp Exp $ */ #include "tclInt.h" @@ -411,6 +411,7 @@ FreeDictInternalRep( } dictPtr->internalRep.otherValuePtr = NULL; /* Belt and braces! */ + dictPtr->typePtr = NULL; } /* diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 778b679..587dd3e 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclExecute.c,v 1.446 2009/09/07 07:28:38 das Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.447 2009/09/30 03:11:25 dgp Exp $ */ #include "tclInt.h" @@ -1393,8 +1393,7 @@ CompileExprObj( || (codePtr->nsPtr != namespacePtr) || (codePtr->nsEpoch != namespacePtr->resolverEpoch) || (codePtr->localCachePtr != iPtr->varFramePtr->localCachePtr)) { - objPtr->typePtr->freeIntRepProc(objPtr); - objPtr->typePtr = (Tcl_ObjType *) NULL; + FreeExprCodeInternalRep(objPtr); } } if (objPtr->typePtr != &exprCodeType) { diff --git a/generic/tclIO.c b/generic/tclIO.c index 6ace57a..737e64e 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIO.c,v 1.161 2009/09/07 07:28:38 das Exp $ + * RCS: @(#) $Id: tclIO.c,v 1.162 2009/09/30 03:11:26 dgp Exp $ */ #include "tclInt.h" @@ -11131,6 +11131,7 @@ FreeChannelIntRep( Tcl_Obj *objPtr) /* Object with internal rep to free. */ { Tcl_Release(GET_CHANNELSTATE(objPtr)); + objPtr->typePtr = NULL; } #if 0 diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c index bbdae95..7125891 100644 --- a/generic/tclIndexObj.c +++ b/generic/tclIndexObj.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIndexObj.c,v 1.51 2009/04/27 09:41:49 nijtmans Exp $ + * RCS: @(#) $Id: tclIndexObj.c,v 1.52 2009/09/30 03:11:26 dgp Exp $ */ #include "tclInt.h" @@ -499,6 +499,7 @@ FreeIndex( Tcl_Obj *objPtr) { ckfree((char *) objPtr->internalRep.otherValuePtr); + objPtr->typePtr = NULL; } /* diff --git a/generic/tclInt.h b/generic/tclInt.h index 1d1851e..0f6654b 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -15,7 +15,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclInt.h,v 1.444 2009/09/29 05:03:46 dgp Exp $ + * RCS: @(#) $Id: tclInt.h,v 1.445 2009/09/30 03:11:26 dgp Exp $ */ #ifndef _TCLINT @@ -3842,6 +3842,7 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, if ((objPtr)->typePtr != NULL && \ (objPtr)->typePtr->freeIntRepProc != NULL) { \ (objPtr)->typePtr->freeIntRepProc(objPtr); \ + (objPtr)->typePtr = NULL; \ } /* diff --git a/generic/tclListObj.c b/generic/tclListObj.c index 50653ab..659017c 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclListObj.c,v 1.57 2009/02/10 22:49:52 nijtmans Exp $ + * RCS: @(#) $Id: tclListObj.c,v 1.58 2009/09/30 03:11:26 dgp Exp $ */ #include "tclInt.h" @@ -1614,6 +1614,7 @@ FreeListInternalRep( listPtr->internalRep.twoPtrValue.ptr1 = NULL; listPtr->internalRep.twoPtrValue.ptr2 = NULL; + listPtr->typePtr = NULL; } /* diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index 74d5ebb..94ade8f 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -23,7 +23,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclNamesp.c,v 1.192 2009/07/15 13:17:18 dkf Exp $ + * RCS: @(#) $Id: tclNamesp.c,v 1.193 2009/09/30 03:11:26 dgp Exp $ */ #include "tclInt.h" @@ -4770,6 +4770,7 @@ FreeNsNameInternalRep( } ckfree((char *) resNamePtr); } + objPtr->typePtr = NULL; } /* @@ -7469,6 +7470,7 @@ FreeEnsembleCmdRep( NamespaceFree(ensembleCmd->nsPtr); } ckfree((char *) ensembleCmd); + objPtr->typePtr = NULL; } /* diff --git a/generic/tclOOCall.c b/generic/tclOOCall.c index e9760f7..e8f9757 100644 --- a/generic/tclOOCall.c +++ b/generic/tclOOCall.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: tclOOCall.c,v 1.14 2009/07/12 14:51:30 dkf Exp $ + * RCS: @(#) $Id: tclOOCall.c,v 1.15 2009/09/30 03:11:26 dgp Exp $ */ #ifdef HAVE_CONFIG_H @@ -173,9 +173,7 @@ StashCallChain( CallChain *callPtr) { callPtr->refCount++; - if (objPtr->typePtr && objPtr->typePtr->freeIntRepProc) { - objPtr->typePtr->freeIntRepProc(objPtr); - } + TclFreeIntRep(objPtr); objPtr->typePtr = &methodNameType; objPtr->internalRep.otherValuePtr = callPtr; } @@ -956,7 +954,7 @@ TclOOGetCallContext( callPtr->refCount++; goto returnContext; } - cacheInThisObj->typePtr->freeIntRepProc(cacheInThisObj); + FreeMethodNameRep(cacheInThisObj); } if (oPtr->flags & USE_CLASS_CACHE) { diff --git a/generic/tclObj.c b/generic/tclObj.c index 2bbc009..e32819d 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclObj.c,v 1.160 2009/09/17 08:39:40 das Exp $ + * RCS: @(#) $Id: tclObj.c,v 1.161 2009/09/30 03:11:26 dgp Exp $ */ #include "tclInt.h" @@ -3130,6 +3130,7 @@ FreeBignum( if ((long) objPtr->internalRep.ptrAndLongRep.value < 0) { ckfree((char *) objPtr->internalRep.ptrAndLongRep.ptr); } + objPtr->typePtr = NULL; } /* @@ -4218,6 +4219,7 @@ FreeCmdNameInternalRep( ckfree((char *) resPtr); } } + objPtr->typePtr = NULL; } /* diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index 3b907a4..7599529 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclPathObj.c,v 1.82 2009/08/20 15:17:39 dgp Exp $ + * RCS: @(#) $Id: tclPathObj.c,v 1.83 2009/09/30 03:11:26 dgp Exp $ */ #include "tclInt.h" @@ -2601,6 +2601,7 @@ FreeFsPathInternalRep( } ckfree((char*) fsPathPtr); + pathPtr->typePtr = NULL; } static void diff --git a/generic/tclProc.c b/generic/tclProc.c index 4eb6c17..806bf11 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclProc.c,v 1.175 2009/09/07 07:28:38 das Exp $ + * RCS: @(#) $Id: tclProc.c,v 1.176 2009/09/30 03:11:26 dgp Exp $ */ #include "tclInt.h" @@ -2439,6 +2439,7 @@ FreeLambdaInternalRep( TclProcCleanupProc(procPtr); } TclDecrRefCount(nsObjPtr); + objPtr->typePtr = NULL; } static int diff --git a/generic/tclRegexp.c b/generic/tclRegexp.c index d0505e0..b912345 100644 --- a/generic/tclRegexp.c +++ b/generic/tclRegexp.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclRegexp.c,v 1.31 2009/02/10 22:49:54 nijtmans Exp $ + * RCS: @(#) $Id: tclRegexp.c,v 1.32 2009/09/30 03:11:26 dgp Exp $ */ #include "tclInt.h" @@ -760,6 +760,7 @@ FreeRegexpInternalRep( if (--(regexpRepPtr->refCount) <= 0) { FreeRegexp(regexpRepPtr); } + objPtr->typePtr = NULL; } /* diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 8b33fe1..8787fd9 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.129 2009/08/27 19:34:24 dgp Exp $ */ + * RCS: @(#) $Id: tclStringObj.c,v 1.130 2009/09/30 03:11:26 dgp Exp $ */ #include "tclInt.h" #include "tommath.h" @@ -2954,6 +2954,7 @@ FreeStringInternalRep( Tcl_Obj *objPtr) /* Object with internal rep to free. */ { ckfree((char *) GET_STRING(objPtr)); + objPtr->typePtr = NULL; } /* -- cgit v0.12