aboutsummaryrefslogtreecommitdiff
path: root/sunrpc/xdr_array.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
committerJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
commit0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (patch)
tree2ea1f8305970753e4a657acb2ccc15ca3eec8e2c /sunrpc/xdr_array.c
parent7d58530341304d403a6626d7f7a1913165fe2f32 (diff)
downloadglibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.gz
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.bz2
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.zip
2.5-18.1
Diffstat (limited to 'sunrpc/xdr_array.c')
-rw-r--r--sunrpc/xdr_array.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/sunrpc/xdr_array.c b/sunrpc/xdr_array.c
index 9f67e7fe62..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,19 +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)
{
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- (void) __fwprintf (stderr, L"%s",
- _("xdr_array: out of memory\n"));
- else
-#endif
- (void) fputs (_("xdr_array: out of memory\n"), stderr);
+ (void) __fxprintf (NULL, "%s", _("xdr_array: out of memory\n"));
return FALSE;
}
- __bzero (target, nodesize);
break;
case XDR_FREE:
@@ -137,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;