summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--generic/tkConfig.c11
2 files changed, 17 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 95265f0..e85728e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2000-10-10 Eric Melski <ericm@ajubasolutions.com>
+
+ * generic/tkConfig.c (Tk_InitOptions): Added
+ Tcl_IncrRefCount/Tcl_DecrRefCount calls on valuePtr, to prevent
+ memory leaks when the value object comes from the option
+ database. [Bug: 6275].
+
2000-10-06 Jeff Hobbs <hobbs@ajubasolutions.com>
* win/Makefile.in (cat32.${OBJEXT}): add win/ subdirectory to
diff --git a/generic/tkConfig.c b/generic/tkConfig.c
index dfdd237..338edb9 100644
--- a/generic/tkConfig.c
+++ b/generic/tkConfig.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: tkConfig.c,v 1.13 2000/10/01 21:31:36 ericm Exp $
+ * RCS: @(#) $Id: tkConfig.c,v 1.14 2000/10/12 21:14:33 ericm Exp $
*/
/*
@@ -549,6 +549,13 @@ Tk_InitOptions(interp, recordPtr, optionTable, tkwin)
continue;
}
+ /*
+ * Bump the reference count on valuePtr, so that it is strongly
+ * referenced here, and will be properly free'd when finished,
+ * regardless of what DoObjConfig does.
+ */
+ Tcl_IncrRefCount(valuePtr);
+
if (DoObjConfig(interp, recordPtr, optionPtr, valuePtr, tkwin,
(Tk_SavedOption *) NULL) != TCL_OK) {
if (interp != NULL) {
@@ -573,8 +580,10 @@ Tk_InitOptions(interp, recordPtr, optionTable, tkwin)
}
Tcl_AddErrorInfo(interp, msg);
}
+ Tcl_DecrRefCount(valuePtr);
return TCL_ERROR;
}
+ Tcl_DecrRefCount(valuePtr);
}
return TCL_OK;
}