diff mbox

[powerdebug] fix window leak

Message ID 1313592027-6153-1-git-send-email-daniel.lezcano@linaro.org
State Accepted
Headers show

Commit Message

Daniel Lezcano Aug. 17, 2011, 2:40 p.m. UTC
The main window creation is misplaced in the loop, it is created several times.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 display.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/display.c b/display.c
index ebc4de6..28c47f3 100644
--- a/display.c
+++ b/display.c
@@ -548,16 +548,14 @@  int display_init(int wdefault)
 
 	getmaxyx(stdscr, maxy, maxx);
 
-	for (i = 0; i < array_size; i++) {
-
-		main_win = subwin(stdscr, maxy - 2, maxx, 1, 0);
-		if (!main_win)
-			return -1;
+	main_win = subwin(stdscr, maxy - 2, maxx, 1, 0);
+	if (!main_win)
+		return -1;
 
+	for (i = 0; i < array_size; i++) {
 		windata[i].pad = newpad(maxrows, maxx);
 		if (!windata[i].pad)
 			return -1;
-
 	}
 
 	header_win = subwin(stdscr, 1, maxx, 0, 0);