summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2009-11-11 18:34:10 +0000
committerderaadt <deraadt@openbsd.org>2009-11-11 18:34:10 +0000
commitb1a67f4caca3531e3a81c5a8ce40ce14d8db6149 (patch)
tree58e4c5e32609bbb8beee8e96b53301786cb86eac
parentobvious use after free, found by parfait (diff)
downloadwireguard-openbsd-b1a67f4caca3531e3a81c5a8ce40ce14d8db6149.tar.xz
wireguard-openbsd-b1a67f4caca3531e3a81c5a8ce40ce14d8db6149.zip
memory leaks, found by parfait; ok millert
-rw-r--r--lib/libcurses/base/lib_newwin.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libcurses/base/lib_newwin.c b/lib/libcurses/base/lib_newwin.c
index d8d4536b651..5e25d33f3cb 100644
--- a/lib/libcurses/base/lib_newwin.c
+++ b/lib/libcurses/base/lib_newwin.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_newwin.c,v 1.4 2001/01/22 18:01:42 millert Exp $ */
+/* $OpenBSD: lib_newwin.c,v 1.5 2009/11/11 18:34:10 deraadt Exp $ */
/****************************************************************************
* Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
@@ -205,10 +205,13 @@ _nc_makenew
if ((wp = typeCalloc(WINDOWLIST, 1)) == 0)
return 0;
- if ((win = typeCalloc(WINDOW, 1)) == 0)
+ if ((win = typeCalloc(WINDOW, 1)) == 0) {
+ free(wp);
return 0;
+ }
if ((win->_line = typeCalloc(struct ldat, ((unsigned) num_lines))) == 0) {
+ free(wp);
free(win);
return 0;
}