about summary refs log tree commit diff
path: root/Src/Modules
diff options
context:
space:
mode:
authorJun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>2018-08-01 21:36:44 +0900
committerJun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>2018-08-01 21:36:44 +0900
commitad9f07e66fded8a44adba15d576960cef587f9d4 (patch)
tree365b51648af05a76a01e9539b6604294f5f38981 /Src/Modules
parent96ea5e32b442ff2406f1d7268cccdd73baf313ea (diff)
downloadzsh-ad9f07e66fded8a44adba15d576960cef587f9d4.tar.gz
zsh-ad9f07e66fded8a44adba15d576960cef587f9d4.tar.xz
zsh-ad9f07e66fded8a44adba15d576960cef587f9d4.zip
43227: fix memory leaks in term{cap,info}.c
Diffstat (limited to 'Src/Modules')
-rw-r--r--Src/Modules/termcap.c14
-rw-r--r--Src/Modules/terminfo.c14
2 files changed, 8 insertions, 20 deletions
diff --git a/Src/Modules/termcap.c b/Src/Modules/termcap.c
index 60a6e138a..af4009a3a 100644
--- a/Src/Modules/termcap.c
+++ b/Src/Modules/termcap.c
@@ -345,16 +345,7 @@ int
 boot_(UNUSED(Module m))
 {
 #ifdef HAVE_TGETENT
-# ifdef HAVE_SETUPTERM
-    int errret;
-
-    /*
-     * Just because we can't set up the terminal doesn't
-     * mean the modules hasn't booted---TERM may change,
-     * and it should be handled dynamically---so ignore errors here.
-     */
-    (void)setupterm((char *)0, 1, &errret);
-# endif
+    zsetupterm();
 #endif
     return  0;
 }
@@ -363,6 +354,9 @@ boot_(UNUSED(Module m))
 int
 cleanup_(Module m)
 {
+#ifdef HAVE_TGETENT
+    zdeleteterm();
+#endif
     return setfeatureenables(m, &module_features, NULL);
 }
 
diff --git a/Src/Modules/terminfo.c b/Src/Modules/terminfo.c
index bbd325899..4596b41d2 100644
--- a/Src/Modules/terminfo.c
+++ b/Src/Modules/terminfo.c
@@ -338,16 +338,7 @@ int
 boot_(UNUSED(Module m))
 {
 #ifdef USE_TERMINFO_MODULE
-# ifdef HAVE_SETUPTERM
-    int errret;
-
-    /*
-     * Just because we can't set up the terminal doesn't
-     * mean the modules hasn't booted---TERM may change,
-     * and it should be handled dynamically---so ignore errors here.
-     */
-    (void)setupterm((char *)0, 1, &errret);
-# endif
+    zsetupterm();
 #endif
 
     return 0;
@@ -357,6 +348,9 @@ boot_(UNUSED(Module m))
 int
 cleanup_(Module m)
 {
+#ifdef USE_TERMINFO_MODULE
+    zdeleteterm();
+#endif
     return setfeatureenables(m, &module_features, NULL);
 }