diff options
author | 2014-10-14 05:38:20 +0000 | |
---|---|---|
committer | 2014-10-14 05:38:20 +0000 | |
commit | db67512b5ada33fee325cbc9bdd4691c2a8895d0 (patch) | |
tree | 821143fe660d953fd76c93adf41982575160283b | |
parent | NetBSD revision 1.20 of pmap.h (from 1996) deleted license text that should (diff) | |
download | wireguard-openbsd-db67512b5ada33fee325cbc9bdd4691c2a8895d0.tar.xz wireguard-openbsd-db67512b5ada33fee325cbc9bdd4691c2a8895d0.zip |
fairly obvious reallocarray() conversion
-rw-r--r-- | lib/libocurses/newwin.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libocurses/newwin.c b/lib/libocurses/newwin.c index e55f18b7414..3c4bb7be727 100644 --- a/lib/libocurses/newwin.c +++ b/lib/libocurses/newwin.c @@ -1,4 +1,4 @@ -/* $OpenBSD: newwin.c,v 1.5 2009/11/11 18:22:05 deraadt Exp $ */ +/* $OpenBSD: newwin.c,v 1.6 2014/10/14 05:38:20 deraadt Exp $ */ /* * Copyright (c) 1981, 1993, 1994 * The Regents of the University of California. All rights reserved. @@ -165,11 +165,11 @@ __makenew(nl, nc, by, bx, sub) /* * Set up line pointer array and line space. */ - if ((win->lines = malloc (nl * sizeof(__LINE *))) == NULL) { + if ((win->lines = reallocarray(NULL, nl, sizeof(__LINE *))) == NULL) { free(win); return NULL; } - if ((win->lspace = malloc (nl * sizeof(__LINE))) == NULL) { + if ((win->lspace = reallocarray(NULL, nl, sizeof(__LINE))) == NULL) { free (win->lines); free (win); return NULL; @@ -180,8 +180,8 @@ __makenew(nl, nc, by, bx, sub) /* * Allocate window space in one chunk. */ - if ((win->wspace = - malloc(nc * nl * sizeof(__LDATA))) == NULL) { + if ((win->wspace = reallocarray(NULL, nc, + nl * sizeof(__LDATA))) == NULL) { free(win->lines); free(win->lspace); free(win); |