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 | |
parent | 21cc1a046497627e2a99f4bd4c248875bea0e57b (diff) |
use reallocarray(); ok doug
-rw-r--r-- | lib/libfuse/fuse_opt.c | 4 | ||||
-rw-r--r-- | lib/libusbhid/usage.c | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/libfuse/fuse_opt.c b/lib/libfuse/fuse_opt.c index c08cbf1d932..ff8f0af86a9 100644 --- a/lib/libfuse/fuse_opt.c +++ b/lib/libfuse/fuse_opt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fuse_opt.c,v 1.10 2014/05/20 13:22:06 syl Exp $ */ +/* $OpenBSD: fuse_opt.c,v 1.11 2014/10/08 04:50:10 deraadt Exp $ */ /* * Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com> * Copyright (c) 2013 Stefan Sperling <stsp@openbsd.org> @@ -343,7 +343,7 @@ fuse_opt_insert_arg(struct fuse_args *args, int p, const char *name) if (p < 0 || p > args->argc) return (-1); - av = realloc(args->argv, (args->argc + 1) * sizeof(*av)); + av = reallocarray(args->argv, args->argc + 1, sizeof(*av)); if (av == NULL) return (-1); 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; |