diff options
| author | andreask@activestate.com <andreas_kupries> | 2009-11-10 17:58:32 (GMT) |
|---|---|---|
| committer | andreask@activestate.com <andreas_kupries> | 2009-11-10 17:58:32 (GMT) |
| commit | ba31ed89d3daad06d84d984ce738d248085d9101 (patch) | |
| tree | 7413041436474b523d6ee337c63b5cb43a8be867 | |
| parent | 2ab8a1fca185dc484bddcf777b8b9150d4e058b4 (diff) | |
| download | tcl-ba31ed89d3daad06d84d984ce738d248085d9101.zip tcl-ba31ed89d3daad06d84d984ce738d248085d9101.tar.gz tcl-ba31ed89d3daad06d84d984ce738d248085d9101.tar.bz2 | |
* generic/tclObj.c: Plus memory leak in TclContinuationsEnter().
[Bug 2895323]. Backport from Tcl 8.5 branch, change by Don Porter.
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | generic/tclObj.c | 13 |
2 files changed, 17 insertions, 1 deletions
@@ -1,3 +1,8 @@ +2009-11-10 Andreas Kupries <andreask@activestate.com> + + * generic/tclObj.c: Plus memory leak in TclContinuationsEnter(). + [Bug 2895323]. Backport from Tcl 8.5 branch, change by Don Porter. + 2009-11-09 Andreas Kupries <andreask@activestate.com> * generic/tclBasic.c (TclEvalObjEx): Moved the #280 decrement of diff --git a/generic/tclObj.c b/generic/tclObj.c index 84d980e..4f51fac 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.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: tclObj.c,v 1.42.2.17 2009/08/25 20:59:11 andreas_kupries Exp $ + * RCS: @(#) $Id: tclObj.c,v 1.42.2.18 2009/11/10 17:58:32 andreas_kupries Exp $ */ #include "tclInt.h" @@ -411,6 +411,17 @@ TclContinuationsEnter(objPtr,num,loc) ContLineLoc* clLocPtr = (ContLineLoc*) ckalloc (sizeof(ContLineLoc) + num*sizeof(int)); + if (!newEntry) { + /* + * Somehow we're entering ContLineLoc data for the same value (objPtr) + * more than one time. Not sure whether that's expected, or a sign of + * trouble, but at a minimum, we should take care not to leak the old + * entry. + */ + + ckfree((char *) Tcl_GetHashValue(hPtr)); + } + clLocPtr->num = num; memcpy (&clLocPtr->loc, loc, num*sizeof(int)); clLocPtr->loc[num] = CLL_END; /* Sentinel */ |
