fix memory leaks (from Rin Okuyama)

This commit is contained in:
christos 2015-11-26 01:05:08 +00:00
parent f5cb16e708
commit 600fe0a3fe

View File

@ -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);