From 1a128afdb2447c103c250fe3f7b55119ccc9c6e4 Mon Sep 17 00:00:00 2001
From: Chris Allegretta <chrisa@asty.org>
Date: Sun, 26 Jan 2003 04:15:56 +0000
Subject: [PATCH] - nano.c:window_init() - Fix leaking *WINDOWs (no pun
 intended) (David Benbennick)

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1391 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog | 6 ++++--
 nano.c    | 7 +++++++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d12a7fdd..6803a3df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,8 @@ CVS Code -
   open_file()
 	- Fix FD leak with file load error (David Benbennick).
 - nano.c:
+  do_preserve_msg():
+	- Unsplit error message into a single fprintf call (Jordi).
   main()
 	- Call load_file with arg 0 for insert, as we aren't really
 	  doing an insert, allows new_file() to run if we open a 
@@ -20,8 +22,8 @@ CVS Code -
   usage()
   	- Remove gettext markings from -p/--preserve (Jordi).
 	- Revamp -H option message to fit in 80 column terminal.
-  do_preserve_msg():
-	- Unsplit error message into a single fprintf call (Jordi).
+  window_init()
+	- Fix leaking *WINDOWs (no pun intended) (David Benbennick).
 - winio.c:
   bottombars()
 	- Change strcpy of gettext() "Up" string to strncpy of max
diff --git a/nano.c b/nano.c
index 37be37a7..5281e925 100644
--- a/nano.c
+++ b/nano.c
@@ -232,6 +232,13 @@ void window_init(void)
     if ((editwinrows = LINES - 5 + no_help()) < MIN_EDITOR_ROWS)
 	die_too_small();
 
+    if (edit != NULL)
+	delwin(edit);
+    if (topwin != NULL)
+	delwin(topwin);
+    if (bottomwin != NULL)
+	delwin(bottomwin);
+
     /* Set up the main text window */
     edit = newwin(editwinrows, COLS, 2, 0);
 
-- 
GitLab