summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/bc/bc.y4
-rw-r--r--usr.bin/mklocale/yacc.y6
2 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/bc/bc.y b/usr.bin/bc/bc.y
index 39ed0cb3597..f7d5a158559 100644
--- a/usr.bin/bc/bc.y
+++ b/usr.bin/bc/bc.y
@@ -1,5 +1,5 @@
%{
-/* $OpenBSD: bc.y,v 1.45 2014/10/08 04:13:33 deraadt Exp $ */
+/* $OpenBSD: bc.y,v 1.46 2014/10/14 15:35:18 deraadt Exp $ */
/*
* Copyright (c) 2003, Otto Moerbeek <otto@drijf.net>
@@ -750,7 +750,7 @@ grow(void)
if (current == instr_sz) {
newsize = instr_sz * 2 + 1;
- p = realloc(instructions, newsize * sizeof(*p));
+ p = reallocarray(instructions, newsize, sizeof(*p));
if (p == NULL) {
free(instructions);
err(1, NULL);
diff --git a/usr.bin/mklocale/yacc.y b/usr.bin/mklocale/yacc.y
index e3bc5c47f34..430256ffe38 100644
--- a/usr.bin/mklocale/yacc.y
+++ b/usr.bin/mklocale/yacc.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: yacc.y,v 1.5 2012/12/05 23:20:25 deraadt Exp $ */
+/* $OpenBSD: yacc.y,v 1.6 2014/10/14 15:35:40 deraadt Exp $ */
/* $NetBSD: yacc.y,v 1.24 2004/01/05 23:23:36 jmmv Exp $ */
%{
@@ -311,7 +311,7 @@ xmalloc(size_t sz)
u_int32_t *
xlalloc(size_t sz)
{
- u_int32_t *r = (u_int32_t *)malloc(sz * sizeof(u_int32_t));
+ u_int32_t *r = (u_int32_t *)reallocarray(NULL, sz, sizeof(u_int32_t));
if (!r) {
perror("xlalloc");
abort();
@@ -322,7 +322,7 @@ xlalloc(size_t sz)
u_int32_t *
xrelalloc(u_int32_t *old, size_t sz)
{
- u_int32_t *r = (u_int32_t *)realloc(old, sz * sizeof(u_int32_t));
+ u_int32_t *r = (u_int32_t *)reallocarray(old, sz, sizeof(u_int32_t));
if (!r) {
perror("xrelalloc");
abort();