From 600fe0a3fee616ce49f140911f2766fb0313b4e7 Mon Sep 17 00:00:00 2001 From: christos Date: Thu, 26 Nov 2015 01:05:08 +0000 Subject: [PATCH] fix memory leaks (from Rin Okuyama) --- lib/libcurses/screen.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/libcurses/screen.c b/lib/libcurses/screen.c index 439dcff41fcc..89ec9bf5e38a 100644 --- a/lib/libcurses/screen.c +++ b/lib/libcurses/screen.c @@ -1,4 +1,4 @@ -/* $NetBSD: screen.c,v 1.23 2010/06/10 05:24:55 dholland Exp $ */ +/* $NetBSD: screen.c,v 1.24 2015/11/26 01:05:08 christos Exp $ */ /* * Copyright (c) 1981, 1993, 1994 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)screen.c 8.2 (blymn) 11/27/2001"; #else -__RCSID("$NetBSD: screen.c,v 1.23 2010/06/10 05:24:55 dholland Exp $"); +__RCSID("$NetBSD: screen.c,v 1.24 2015/11/26 01:05:08 christos Exp $"); #endif #endif /* not lint */ @@ -207,6 +207,10 @@ newterm(char *type, FILE *outfd, FILE *infd) return new_screen; error_exit: + if (new_screen->term != NULL) + (void)del_curterm(new_screen->term); + free(new_screen->unget_list); + free(new_screen); return NULL; } @@ -239,7 +243,7 @@ delscreen(SCREEN *screen) _cursesi_free_keymap(screen->base_keymap); free(screen->stdbuf); - screen->stdbuf = NULL; + free(screen->unget_list); if (_cursesi_screen == screen) _cursesi_screen = NULL; free(screen);