From 931d39ec0ef8235f9cbfb8d72d177594486ff276 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Tue, 14 Oct 2014 15:35:41 +0000 Subject: obvious use of reallocarray() --- usr.bin/mklocale/yacc.y | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'usr.bin/mklocale') 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(); -- cgit v1.2.3