summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib
diff options
context:
space:
mode:
authormaya <maya@NetBSD.org>2017-11-27 23:54:28 +0000
committermaya <maya@NetBSD.org>2017-11-27 23:54:28 +0000
commitab5479dbffcfdda237d5091f573ddea6bf9009de (patch)
treece2e0dfd3b05c788d0f578d748e6ff18b0d317d0 /lib/libc/stdlib
parent3d7b5d498aa9609f2bc9ece9c734c5f493a8e239 (diff)
use calloc rather than malloc + memset 0
Diffstat (limited to 'lib/libc/stdlib')
-rw-r--r--lib/libc/stdlib/strfmon.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/libc/stdlib/strfmon.c b/lib/libc/stdlib/strfmon.c
index 1dbc44d6f59..2de8d276359 100644
--- a/lib/libc/stdlib/strfmon.c
+++ b/lib/libc/stdlib/strfmon.c
@@ -1,4 +1,4 @@
-/* $NetBSD: strfmon.c,v 1.12 2017/11/27 22:43:07 christos Exp $ */
+/* $NetBSD: strfmon.c,v 1.13 2017/11/27 23:54:28 maya Exp $ */
/*-
* Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org>
@@ -32,7 +32,7 @@
#if 0
__FBSDID("$FreeBSD: src/lib/libc/stdlib/strfmon.c,v 1.14 2003/03/20 08:18:55 ache Exp $");
#else
-__RCSID("$NetBSD: strfmon.c,v 1.12 2017/11/27 22:43:07 christos Exp $");
+__RCSID("$NetBSD: strfmon.c,v 1.13 2017/11/27 23:54:28 maya Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -556,12 +556,11 @@ __format_grouped_double(struct lconv *lc, double value, int *flags,
/* make sure that we've enough space for result string */
bufsize = avalue_size * 2 + 1;
- rslt = malloc(bufsize);
+ rslt = calloc(1, bufsize);
if (rslt == NULL) {
free(avalue);
return (NULL);
}
- memset(rslt, 0, bufsize);
bufend = rslt + bufsize - 1; /* reserve space for trailing '\0' */
/* skip spaces at beggining */