summaryrefslogtreecommitdiffstats
path: root/generic/tclObj.c
diff options
context:
space:
mode:
authorandreas_kupries <akupries@shaw.ca>2009-11-10 17:57:39 (GMT)
committerandreas_kupries <akupries@shaw.ca>2009-11-10 17:57:39 (GMT)
commitff59f687d9a7ba1a84e8254166258300183af233 (patch)
tree20d35c6979a77c618278963093dbb94cb6891c17 /generic/tclObj.c
parent87c01b989008cb30c049831de30fd6005f8e45bc (diff)
downloadtcl-ff59f687d9a7ba1a84e8254166258300183af233.zip
tcl-ff59f687d9a7ba1a84e8254166258300183af233.tar.gz
tcl-ff59f687d9a7ba1a84e8254166258300183af233.tar.bz2
* generic/tclObj.c: Plus memory leak in TclContinuationsEnter().
[Bug 2895323]. Forward port from Tcl 8.5 branch, change by Don Porter.
Diffstat (limited to 'generic/tclObj.c')
-rw-r--r--generic/tclObj.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/generic/tclObj.c b/generic/tclObj.c
index 8869e9b..5913dd1 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.163 2009/10/18 10:39:41 mistachkin Exp $
+ * RCS: @(#) $Id: tclObj.c,v 1.164 2009/11/10 17:57:39 andreas_kupries Exp $
*/
#include "tclInt.h"
@@ -582,6 +582,17 @@ TclContinuationsEnter(Tcl_Obj* objPtr,
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 */