summaryrefslogtreecommitdiffstats
path: root/generic/tkWindow.c
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2023-07-19 21:16:15 (GMT)
committerfvogel <fvogelnew1@free.fr>2023-07-19 21:16:15 (GMT)
commit071b0348c412d60e937447c5c1cd4011cb9381b5 (patch)
tree0b7468a74c033f8df42f8502e0c32a92a316b7fc /generic/tkWindow.c
parent111379aa313dcebc58385b6e7da71a3f49274f10 (diff)
downloadtk-071b0348c412d60e937447c5c1cd4011cb9381b5.zip
tk-071b0348c412d60e937447c5c1cd4011cb9381b5.tar.gz
tk-071b0348c412d60e937447c5c1cd4011cb9381b5.tar.bz2
Fix [c35c3419ea]: leak in Initialize() when -name not provided. Patch from Christopher Chavez.
Diffstat (limited to 'generic/tkWindow.c')
-rw-r--r--generic/tkWindow.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index 59c1243..9ab59a3 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -3130,6 +3130,7 @@ Initialize(
Tcl_Obj *cmd;
Tcl_Obj *nameObj = NULL;
+ Tcl_Obj* appNameObj = NULL;
Tcl_Obj *classObj = NULL;
Tcl_Obj *displayObj = NULL;
Tcl_Obj *colorMapObj = NULL;
@@ -3295,6 +3296,8 @@ Initialize(
TkpGetAppName(interp, &nameDS);
nameObj = Tcl_NewStringObj(Tcl_DStringValue(&nameDS),
Tcl_DStringLength(&nameDS));
+ appNameObj = nameObj;
+ Tcl_IncrRefCount(appNameObj);
Tcl_DStringFree(&nameDS);
}
@@ -3456,6 +3459,10 @@ tkInit", -1, TCL_EVAL_GLOBAL);
Tcl_DecrRefCount(value);
value = NULL;
}
+ if (appNameObj) {
+ Tcl_DecrRefCount(appNameObj);
+ appNameObj = NULL;
+ }
return code;
}