summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorericm <ericm@noemail.net>2000-10-12 21:14:33 (GMT)
committerericm <ericm@noemail.net>2000-10-12 21:14:33 (GMT)
commit6b15f508000c0e1ea25db585725cca8bcb4cb67c (patch)
treec5524617745bf82375c8e0049caac0096b0e1cbf /generic
parent4716430f777d19afdb33b0130e1816945e0a33a8 (diff)
downloadtk-6b15f508000c0e1ea25db585725cca8bcb4cb67c.zip
tk-6b15f508000c0e1ea25db585725cca8bcb4cb67c.tar.gz
tk-6b15f508000c0e1ea25db585725cca8bcb4cb67c.tar.bz2
* 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]. FossilOrigin-Name: 82cff3a21c654d5dfe8166d744c8475afd2a52a6
Diffstat (limited to 'generic')
-rw-r--r--generic/tkConfig.c11
1 files changed, 10 insertions, 1 deletions
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;
}