use malloc rather than mem_alloc (which is implemented using calloc)
for receive/send buffers to avoid unnecessarily anonymous memory bloat.
This commit is contained in:
parent
a51d4c4377
commit
2d02304deb
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: clnt_dg.c,v 1.14 2004/12/30 05:06:33 christos Exp $ */
|
||||
/* $NetBSD: clnt_dg.c,v 1.15 2005/06/09 22:13:17 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -39,7 +39,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)clnt_dg.c 1.19 89/03/16 Copyr 1988 Sun Micro";
|
||||
#else
|
||||
__RCSID("$NetBSD: clnt_dg.c,v 1.14 2004/12/30 05:06:33 christos Exp $");
|
||||
__RCSID("$NetBSD: clnt_dg.c,v 1.15 2005/06/09 22:13:17 yamt Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -241,9 +241,10 @@ clnt_dg_create(fd, svcaddr, program, version, sendsz, recvsz)
|
|||
*/
|
||||
sendsz = ((sendsz + 3) / 4) * 4;
|
||||
recvsz = ((recvsz + 3) / 4) * 4;
|
||||
cu = mem_alloc(sizeof (*cu) + sendsz + recvsz);
|
||||
cu = malloc(sizeof (*cu) + sendsz + recvsz);
|
||||
if (cu == NULL)
|
||||
goto err1;
|
||||
memset(cu, 0, sizeof(*cu));
|
||||
(void) memcpy(&cu->cu_raddr, svcaddr->buf, (size_t)svcaddr->len);
|
||||
cu->cu_rlen = svcaddr->len;
|
||||
cu->cu_outbuf = &cu->cu_inbuf[recvsz];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: clnt_raw.c,v 1.25 2004/12/30 05:08:37 christos Exp $ */
|
||||
/* $NetBSD: clnt_raw.c,v 1.26 2005/06/09 22:13:17 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -35,7 +35,7 @@
|
|||
static char *sccsid = "@(#)clnt_raw.c 1.22 87/08/11 Copyr 1984 Sun Micro";
|
||||
static char *sccsid = "@(#)clnt_raw.c 2.2 88/08/01 4.0 RPCSRC";
|
||||
#else
|
||||
__RCSID("$NetBSD: clnt_raw.c,v 1.25 2004/12/30 05:08:37 christos Exp $");
|
||||
__RCSID("$NetBSD: clnt_raw.c,v 1.26 2005/06/09 22:13:17 yamt Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -116,7 +116,7 @@ clnt_raw_create(prog, vers)
|
|||
}
|
||||
if (__rpc_rawcombuf == NULL)
|
||||
__rpc_rawcombuf =
|
||||
calloc((size_t)UDPMSGSIZE, sizeof (char));
|
||||
malloc(UDPMSGSIZE);
|
||||
clp->_raw_buf = __rpc_rawcombuf;
|
||||
clntraw_private = clp;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: svc_dg.c,v 1.10 2003/09/09 03:56:40 itojun Exp $ */
|
||||
/* $NetBSD: svc_dg.c,v 1.11 2005/06/09 22:13:17 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -44,7 +44,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: svc_dg.c,v 1.10 2003/09/09 03:56:40 itojun Exp $");
|
||||
__RCSID("$NetBSD: svc_dg.c,v 1.11 2005/06/09 22:13:17 yamt Exp $");
|
||||
#endif
|
||||
|
||||
#include "namespace.h"
|
||||
|
@ -138,7 +138,7 @@ svc_dg_create(fd, sendsize, recvsize)
|
|||
if (su == NULL)
|
||||
goto freedata;
|
||||
su->su_iosz = ((MAX(sendsize, recvsize) + 3) / 4) * 4;
|
||||
if ((rpc_buffer(xprt) = mem_alloc(su->su_iosz)) == NULL)
|
||||
if ((rpc_buffer(xprt) = malloc(su->su_iosz)) == NULL)
|
||||
goto freedata;
|
||||
xdrmem_create(&(su->su_xdrs), rpc_buffer(xprt), su->su_iosz,
|
||||
XDR_DECODE);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: svc_raw.c,v 1.17 2003/09/09 03:56:40 itojun Exp $ */
|
||||
/* $NetBSD: svc_raw.c,v 1.18 2005/06/09 22:13:17 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -39,7 +39,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)svc_raw.c 1.25 89/01/31 Copyr 1984 Sun Micro";
|
||||
#else
|
||||
__RCSID("$NetBSD: svc_raw.c,v 1.17 2003/09/09 03:56:40 itojun Exp $");
|
||||
__RCSID("$NetBSD: svc_raw.c,v 1.18 2005/06/09 22:13:17 yamt Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -107,7 +107,7 @@ svc_raw_create()
|
|||
return (NULL);
|
||||
}
|
||||
if (__rpc_rawcombuf == NULL)
|
||||
__rpc_rawcombuf = calloc(UDPMSGSIZE, sizeof (char));
|
||||
__rpc_rawcombuf = malloc(UDPMSGSIZE);
|
||||
srp->raw_buf = __rpc_rawcombuf; /* Share it with the client */
|
||||
svc_raw_private = srp;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: xdr_rec.c,v 1.24 2003/10/03 21:29:16 christos Exp $ */
|
||||
/* $NetBSD: xdr_rec.c,v 1.25 2005/06/09 22:13:17 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -35,7 +35,7 @@
|
|||
static char *sccsid = "@(#)xdr_rec.c 1.21 87/08/11 Copyr 1984 Sun Micro";
|
||||
static char *sccsid = "@(#)xdr_rec.c 2.2 88/08/01 4.0 RPCSRC";
|
||||
#else
|
||||
__RCSID("$NetBSD: xdr_rec.c,v 1.24 2003/10/03 21:29:16 christos Exp $");
|
||||
__RCSID("$NetBSD: xdr_rec.c,v 1.25 2005/06/09 22:13:17 yamt Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -194,7 +194,7 @@ xdrrec_create(xdrs, sendsize, recvsize, tcp_handle, readit, writeit)
|
|||
}
|
||||
|
||||
rstrm->sendsize = sendsize = fix_buf_size(sendsize);
|
||||
rstrm->out_base = mem_alloc(rstrm->sendsize);
|
||||
rstrm->out_base = malloc(rstrm->sendsize);
|
||||
if (rstrm->out_base == NULL) {
|
||||
warnx("xdrrec_create: out of memory");
|
||||
mem_free(rstrm, sizeof(RECSTREAM));
|
||||
|
@ -202,7 +202,7 @@ xdrrec_create(xdrs, sendsize, recvsize, tcp_handle, readit, writeit)
|
|||
}
|
||||
|
||||
rstrm->recvsize = recvsize = fix_buf_size(recvsize);
|
||||
rstrm->in_base = mem_alloc(recvsize);
|
||||
rstrm->in_base = malloc(recvsize);
|
||||
if (rstrm->in_base == NULL) {
|
||||
warnx("xdrrec_create: out of memory");
|
||||
mem_free(rstrm->out_base, sendsize);
|
||||
|
|
Loading…
Reference in New Issue