summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2007-04-24 20:46:08 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2007-04-24 20:46:08 (GMT)
commit7b0b933b49c5110702dc91cac7a4b91e589d81a0 (patch)
tree003b4f5e1f0cb76d5bb70a892eb128874985d266
parentb65e715b6bc8283ff6654e4af6c269227eb680c1 (diff)
downloadtcl-7b0b933b49c5110702dc91cac7a4b91e589d81a0.zip
tcl-7b0b933b49c5110702dc91cac7a4b91e589d81a0.tar.gz
tcl-7b0b933b49c5110702dc91cac7a4b91e589d81a0.tar.bz2
Fix [Bug 1705778, leak K05]
-rw-r--r--ChangeLog2
-rw-r--r--generic/tclDictObj.c8
2 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index f125567..be235dc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,8 @@
* generic/tclDictObj.c (DictKeysCmd): Rewrote so that the lock on the
internal representation of a dict is only set when necessary. [Bug
1705778, leak K04]
+ (DictFilterCmd): Added code to drop the lock in the trivial match
+ case. [Bug 1705778, leak K05]
2007-04-24 Kevin B. Kenny <kennykb@acm.org>
diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c
index c528b49..3fa5b65 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.48 2007/04/24 20:19:58 dkf Exp $
+ * RCS: @(#) $Id: tclDictObj.c,v 1.49 2007/04/24 20:46:09 dkf Exp $
*/
#include "tclInt.h"
@@ -2453,6 +2453,12 @@ DictFilterCmd(
pattern = TclGetString(objv[4]);
resultObj = Tcl_NewDictObj();
if (TclMatchIsTrivial(pattern)) {
+ /*
+ * Must release the search lock here to prevent a memory leak
+ * since we are not exhausing the search. [Bug 1705778, leak K05]
+ */
+
+ Tcl_DictObjDone(&search);
Tcl_DictObjGet(interp, objv[2], objv[4], &valueObj);
if (valueObj != NULL) {
Tcl_DictObjPut(interp, resultObj, objv[4], valueObj);