diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2014-10-08 04:50:11 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2014-10-08 04:50:11 +0000 |
commit | ff9a6ada2d45b94c50754ada32b59bda968a0f94 (patch) | |
tree | f9ded58a271a4e4822dda68cb980b12be7fdf930 /lib/libusbhid/usage.c | |
parent | 21cc1a046497627e2a99f4bd4c248875bea0e57b (diff) |
use reallocarray(); ok doug
Diffstat (limited to 'lib/libusbhid/usage.c')
-rw-r--r-- | lib/libusbhid/usage.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libusbhid/usage.c b/lib/libusbhid/usage.c index 22b4367ec0b..ebd90e4f518 100644 --- a/lib/libusbhid/usage.c +++ b/lib/libusbhid/usage.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usage.c,v 1.15 2013/11/29 19:00:51 deraadt Exp $ */ +/* $OpenBSD: usage.c,v 1.16 2014/10/08 04:49:36 deraadt Exp $ */ /* $NetBSD: usage.c,v 1.1 2001/12/28 17:45:27 augustss Exp $ */ /* @@ -126,8 +126,8 @@ hid_start(const char *hidname) int len; len = curpage->pagesizemax + 10; - new = realloc(curpage->page_contents, - len * sizeof (struct usage_in_page)); + new = reallocarray(curpage->page_contents, + len, sizeof(struct usage_in_page)); if (!new) { free(curpage->page_contents); curpage->page_contents = NULL; @@ -151,8 +151,8 @@ hid_start(const char *hidname) sizeof (struct usage_page)); } else { len = npagesmax * 5; - new = realloc(pages, - len * sizeof (struct usage_page)); + new = reallocarray(pages, + len, sizeof(struct usage_page)); if (!new) { free(n); goto fail; |