summaryrefslogtreecommitdiffstats
path: root/generic/tkConfig.c
diff options
context:
space:
mode:
authorericm <ericm>2000-10-12 21:14:33 (GMT)
committerericm <ericm>2000-10-12 21:14:33 (GMT)
commitcf232785ce80073052aa5a13c154a4707343da30 (patch)
treec5524617745bf82375c8e0049caac0096b0e1cbf /generic/tkConfig.c
parent828191c52e5612c668e01dd6d75509297aea5e51 (diff)
downloadtk-cf232785ce80073052aa5a13c154a4707343da30.zip
tk-cf232785ce80073052aa5a13c154a4707343da30.tar.gz
tk-cf232785ce80073052aa5a13c154a4707343da30.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].
Diffstat (limited to 'generic/tkConfig.c')
-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;
}