diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-12-22 20:10:10 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-12-22 20:10:10 +0000 |
commit | a334319f6530564d22e775935d9c91663623a1b4 (patch) | |
tree | b5877475619e4c938e98757d518bb1e9cbead751 /sunrpc/xdr_array.c | |
parent | 0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (diff) | |
download | glibc-a334319f6530564d22e775935d9c91663623a1b4.zip glibc-a334319f6530564d22e775935d9c91663623a1b4.tar.gz glibc-a334319f6530564d22e775935d9c91663623a1b4.tar.bz2 |
(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
Diffstat (limited to 'sunrpc/xdr_array.c')
-rw-r--r-- | sunrpc/xdr_array.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sunrpc/xdr_array.c b/sunrpc/xdr_array.c index 44abdbc..9f67e7f 100644 --- a/sunrpc/xdr_array.c +++ b/sunrpc/xdr_array.c @@ -74,6 +74,7 @@ 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)) @@ -89,6 +90,7 @@ xdr_array (xdrs, addrp, sizep, maxsize, elsize, elproc) { return FALSE; } + nodesize = c * elsize; /* * if we are deserializing, we may need to allocate an array. @@ -100,12 +102,19 @@ xdr_array (xdrs, addrp, sizep, maxsize, elsize, elproc) case XDR_DECODE: if (c == 0) return TRUE; - *addrp = target = calloc (c, elsize); + *addrp = target = mem_alloc (nodesize); if (target == NULL) { - (void) __fxprintf (NULL, "%s", _("xdr_array: out of memory\n")); +#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); return FALSE; } + __bzero (target, nodesize); break; case XDR_FREE: @@ -128,7 +137,7 @@ xdr_array (xdrs, addrp, sizep, maxsize, elsize, elproc) */ if (xdrs->x_op == XDR_FREE) { - mem_free (*addrp, c * elsize); + mem_free (*addrp, nodesize); *addrp = NULL; } return stat; |