summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>2008-04-07 23:14:36 (GMT)
committerhobbs <hobbs>2008-04-07 23:14:36 (GMT)
commit336c6a7ae7557bae330981e3ff138b77bd428bfd (patch)
treedfaf40a6b54e37f82f0ae776839fe5fd63d377a5
parent96a6fac144d34cba9596355d01ac7983ed948f43 (diff)
downloadtk-336c6a7ae7557bae330981e3ff138b77bd428bfd.zip
tk-336c6a7ae7557bae330981e3ff138b77bd428bfd.tar.gz
tk-336c6a7ae7557bae330981e3ff138b77bd428bfd.tar.bz2
* generic/tkWindow.c (Initialize): fix double-free on Tk_ParseArgv
* tests/main.test (main-3.*): error. [Bug 1937135]
-rw-r--r--ChangeLog3
-rw-r--r--generic/tkWindow.c3
-rw-r--r--tests/main.test26
3 files changed, 29 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 46e072d..46b00ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2008-04-07 Jeff Hobbs <jeffh@ActiveState.com>
+ * generic/tkWindow.c (Initialize): fix double-free on Tk_ParseArgv
+ * tests/main.test (main-3.*): error. [Bug 1937135]
+
* generic/tkArgv.c: fix -help mem explosion. [Bug 1936238] (kenny)
2008-04-04 Pat Thoyts <patthoyts@users.sourceforge.net>
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index b021f49..854bb82 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWindow.c,v 1.92 2008/04/02 04:06:38 dgp Exp $
+ * RCS: @(#) $Id: tkWindow.c,v 1.93 2008/04/07 23:14:36 hobbs Exp $
*/
#include "tkInt.h"
@@ -3080,7 +3080,6 @@ Initialize(
if (Tk_ParseArgv(interp, (Tk_Window) NULL, &argc, argv,
argTable, TK_ARGV_DONT_SKIP_FIRST_ARG|TK_ARGV_NO_DEFAULTS)
!= TCL_OK) {
- ckfree((char *) argv);
goto argError;
}
p = Tcl_Merge(argc, argv);
diff --git a/tests/main.test b/tests/main.test
index d37240f..ede20f3 100644
--- a/tests/main.test
+++ b/tests/main.test
@@ -8,7 +8,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: main.test,v 1.10 2004/12/08 03:03:06 dgp Exp $
+# RCS: @(#) $Id: main.test,v 1.11 2008/04/07 23:14:39 hobbs Exp $
package require tcltest 2.1
eval tcltest::configure $argv
@@ -99,6 +99,30 @@ test main-2.3 {Tk_MainEx: -encoding option} -constraints {
removeFile script
} -result {0 {-enc utf-8 script}}
+test main-3.1 {Tk_ParseArgv: -help option} -constraints unix -body {
+ # Run only on unix as Win32 pops up native dialog
+ list [catch {exec [interpreter] -help} msg] $msg
+} -match glob -result {1 {% Application initialization failed: Command-specific options:*}}
+
+test main-3.2 {Tk_ParseArgv: -help option} -setup {
+ set maininterp [interp create]
+} -body {
+ $maininterp eval { set argc 1 ; set argv -help }
+ list [catch {load {} Tk $maininterp} msg] $msg
+} -cleanup {
+ interp delete $maininterp
+} -match glob -result {1 {Command-specific options:*}}
+
+test main-3.3 {Tk_ParseArgv: -help option} -setup {
+ set maininterp [interp create]
+} -body {
+ # Repeat of 3.2 to catch cleanup, eg Bug 1927135
+ $maininterp eval { set argc 1 ; set argv -help }
+ list [catch {load {} Tk $maininterp} msg] $msg
+} -cleanup {
+ interp delete $maininterp
+} -match glob -result {1 {Command-specific options:*}}
+
# cleanup
cleanupTests
return