aboutsummaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-27 13:36:27 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-27 13:36:27 +0000
commitc83883cf4ee602c6c6abdf8c25eeb88b551bd222 (patch)
tree877a24719b57ef64bf261b5bd43ef01a3a5d576e /ext
parent19341b86be0e366c4656a2777a6abd4d754070a4 (diff)
downloadruby-c83883cf4ee602c6c6abdf8c25eeb88b551bd222.tar.gz
tcltklib.c: fix memory leak
* ext/tk/tcltklib.c (ip_init): reject already initialized interpreter to fix memory leak. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/tk/tcltklib.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/tk/tcltklib.c b/ext/tk/tcltklib.c
index 4a1d3b8317..40d546ea9d 100644
--- a/ext/tk/tcltklib.c
+++ b/ext/tk/tcltklib.c
@@ -6134,6 +6134,9 @@ ip_init(argc, argv, self)
/* create object */
TypedData_Get_Struct(self, struct tcltkip, &tcltkip_type, ptr);
+ if (DATA_PTR(self)) {
+ rb_raise(rb_eArgError, "already initialized interpreter");
+ }
ptr = ALLOC(struct tcltkip);
/* ptr = RbTk_ALLOC_N(struct tcltkip, 1); */
DATA_PTR(self) = ptr;