summaryrefslogtreecommitdiff
path: root/sunrpc/xdr_array.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-05-04 20:56:12 +0000
committerUlrich Drepper <drepper@redhat.com>2006-05-04 20:56:12 +0000
commit5e65a53d5474bc0baf0ea6d90548e22b3ee7b501 (patch)
treedccb6967cfb92e31c17117ebe0e45b05d77a4282 /sunrpc/xdr_array.c
parent48be31142a07498609795d7c172a923919e4a477 (diff)
downloadglibc-5e65a53d5474bc0baf0ea6d90548e22b3ee7b501.tar.gz
* sunrpc/xdr_array.c (xdr_array): Use calloc instead of malloc&bzero.
Diffstat (limited to 'sunrpc/xdr_array.c')
-rw-r--r--sunrpc/xdr_array.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/sunrpc/xdr_array.c b/sunrpc/xdr_array.c
index 765f8995d3..44abdbcfda 100644
--- a/sunrpc/xdr_array.c
+++ b/sunrpc/xdr_array.c
@@ -74,7 +74,6 @@ xdr_array (xdrs, addrp, sizep, maxsize, elsize, elproc)
caddr_t target = *addrp;
u_int c; /* the actual element count */
bool_t stat = TRUE;
- u_int nodesize;
/* like strings, arrays are really counted arrays */
if (!INTUSE(xdr_u_int) (xdrs, sizep))
@@ -90,7 +89,6 @@ xdr_array (xdrs, addrp, sizep, maxsize, elsize, elproc)
{
return FALSE;
}
- nodesize = c * elsize;
/*
* if we are deserializing, we may need to allocate an array.
@@ -102,13 +100,12 @@ xdr_array (xdrs, addrp, sizep, maxsize, elsize, elproc)
case XDR_DECODE:
if (c == 0)
return TRUE;
- *addrp = target = mem_alloc (nodesize);
+ *addrp = target = calloc (c, elsize);
if (target == NULL)
{
(void) __fxprintf (NULL, "%s", _("xdr_array: out of memory\n"));
return FALSE;
}
- __bzero (target, nodesize);
break;
case XDR_FREE:
@@ -131,7 +128,7 @@ xdr_array (xdrs, addrp, sizep, maxsize, elsize, elproc)
*/
if (xdrs->x_op == XDR_FREE)
{
- mem_free (*addrp, nodesize);
+ mem_free (*addrp, c * elsize);
*addrp = NULL;
}
return stat;