mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
* sunrpc/xdr_array.c (xdr_array): Use calloc instead of malloc&bzero.
This commit is contained in:
@ -1,5 +1,7 @@
|
|||||||
2006-05-04 Ulrich Drepper <drepper@redhat.com>
|
2006-05-04 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* sunrpc/xdr_array.c (xdr_array): Use calloc instead of malloc&bzero.
|
||||||
|
|
||||||
* sunrpc/key_call.c (__rpc_thread_key_cleanup): Also free
|
* sunrpc/key_call.c (__rpc_thread_key_cleanup): Also free
|
||||||
client->cl_auth.
|
client->cl_auth.
|
||||||
|
|
||||||
|
@ -74,7 +74,6 @@ xdr_array (xdrs, addrp, sizep, maxsize, elsize, elproc)
|
|||||||
caddr_t target = *addrp;
|
caddr_t target = *addrp;
|
||||||
u_int c; /* the actual element count */
|
u_int c; /* the actual element count */
|
||||||
bool_t stat = TRUE;
|
bool_t stat = TRUE;
|
||||||
u_int nodesize;
|
|
||||||
|
|
||||||
/* like strings, arrays are really counted arrays */
|
/* like strings, arrays are really counted arrays */
|
||||||
if (!INTUSE(xdr_u_int) (xdrs, sizep))
|
if (!INTUSE(xdr_u_int) (xdrs, sizep))
|
||||||
@ -90,7 +89,6 @@ xdr_array (xdrs, addrp, sizep, maxsize, elsize, elproc)
|
|||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
nodesize = c * elsize;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if we are deserializing, we may need to allocate an array.
|
* 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:
|
case XDR_DECODE:
|
||||||
if (c == 0)
|
if (c == 0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
*addrp = target = mem_alloc (nodesize);
|
*addrp = target = calloc (c, elsize);
|
||||||
if (target == NULL)
|
if (target == NULL)
|
||||||
{
|
{
|
||||||
(void) __fxprintf (NULL, "%s", _("xdr_array: out of memory\n"));
|
(void) __fxprintf (NULL, "%s", _("xdr_array: out of memory\n"));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
__bzero (target, nodesize);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XDR_FREE:
|
case XDR_FREE:
|
||||||
@ -131,7 +128,7 @@ xdr_array (xdrs, addrp, sizep, maxsize, elsize, elproc)
|
|||||||
*/
|
*/
|
||||||
if (xdrs->x_op == XDR_FREE)
|
if (xdrs->x_op == XDR_FREE)
|
||||||
{
|
{
|
||||||
mem_free (*addrp, nodesize);
|
mem_free (*addrp, c * elsize);
|
||||||
*addrp = NULL;
|
*addrp = NULL;
|
||||||
}
|
}
|
||||||
return stat;
|
return stat;
|
||||||
|
Reference in New Issue
Block a user