diff options
author | Juli Mallett <jmallett@FreeBSD.org> | 2002-05-17 05:27:52 +0000 |
---|---|---|
committer | Juli Mallett <jmallett@FreeBSD.org> | 2002-05-17 05:27:52 +0000 |
commit | 2244ec01639e893fbe25f11d8894aced4889b6ec (patch) | |
tree | d2a35e41434d5837169a7025a25d3d714137b4ab /usr.sbin/rpcbind | |
parent | ca9cbcece07db63635cc88205d166ea289ca7beb (diff) | |
download | src-2244ec01639e893fbe25f11d8894aced4889b6ec.tar.gz src-2244ec01639e893fbe25f11d8894aced4889b6ec.zip |
Stop this program's abuse of malloc(3). Its return value doesn't need these
ugly explicit casts, and its argument doesn't need explicitly cast to u_int,
especially if sizeof() is being used.
Notes
Notes:
svn path=/head/; revision=96788
Diffstat (limited to 'usr.sbin/rpcbind')
-rw-r--r-- | usr.sbin/rpcbind/check_bound.c | 2 | ||||
-rw-r--r-- | usr.sbin/rpcbind/rpcb_svc_4.c | 3 | ||||
-rw-r--r-- | usr.sbin/rpcbind/rpcb_svc_com.c | 10 | ||||
-rw-r--r-- | usr.sbin/rpcbind/rpcbind.c | 16 |
4 files changed, 14 insertions, 17 deletions
diff --git a/usr.sbin/rpcbind/check_bound.c b/usr.sbin/rpcbind/check_bound.c index e5f7081b6f17..c9555067e775 100644 --- a/usr.sbin/rpcbind/check_bound.c +++ b/usr.sbin/rpcbind/check_bound.c @@ -117,7 +117,7 @@ add_bndlist(struct netconfig *nconf, struct netbuf *baddr) newnconf = getnetconfigent(nconf->nc_netid); if (newnconf == NULL) return (-1); - fdl = (struct fdlist *)malloc((u_int)sizeof (struct fdlist)); + fdl = malloc(sizeof (struct fdlist)); if (fdl == NULL) { freenetconfigent(newnconf); syslog(LOG_ERR, "no memory!"); diff --git a/usr.sbin/rpcbind/rpcb_svc_4.c b/usr.sbin/rpcbind/rpcb_svc_4.c index f1bae5281525..0b2d4a8e46a3 100644 --- a/usr.sbin/rpcbind/rpcb_svc_4.c +++ b/usr.sbin/rpcbind/rpcb_svc_4.c @@ -389,8 +389,7 @@ rpcbproc_getaddrlist_4_local(void *arg, struct svc_req *rqstp, SVCXPRT *transp, /* * Add it to rlist. */ - rp = (rpcb_entry_list_ptr) - malloc((u_int)sizeof (rpcb_entry_list)); + rp = malloc(sizeof (rpcb_entry_list)); if (rp == NULL) goto fail; a = &rp->rpcb_entry_map; diff --git a/usr.sbin/rpcbind/rpcb_svc_com.c b/usr.sbin/rpcbind/rpcb_svc_com.c index eeded613d671..ad9275ee3845 100644 --- a/usr.sbin/rpcbind/rpcb_svc_com.c +++ b/usr.sbin/rpcbind/rpcb_svc_com.c @@ -170,10 +170,9 @@ map_set(RPCB *regp, char *owner) /* * add to the end of the list */ - rbl = (rpcblist_ptr) malloc((u_int)sizeof (RPCBLIST)); - if (rbl == (rpcblist_ptr)NULL) { + rbl = malloc(sizeof (RPCBLIST)); + if (rbl == NULL) return (FALSE); - } a = &(rbl->rpcb_map); a->r_prog = reg.r_prog; a->r_vers = reg.r_vers; @@ -506,8 +505,7 @@ create_rmtcall_fd(struct netconfig *nconf) "create_rmtcall_fd: svc_tli_create failed\n"); return (-1); } - rmt = (struct rmtcallfd_list *)malloc((u_int) - sizeof (struct rmtcallfd_list)); + rmt = malloc(sizeof (struct rmtcallfd_list)); if (rmt == NULL) { syslog(LOG_ERR, "create_rmtcall_fd: no memory!"); return (-1); @@ -1400,7 +1398,7 @@ add_pmaplist(RPCB *arg) /* * add to END of list */ - pml = (struct pmaplist *) malloc((u_int)sizeof (struct pmaplist)); + pml = malloc(sizeof (struct pmaplist)); if (pml == NULL) { (void) syslog(LOG_ERR, "rpcbind: no memory!\n"); return (1); diff --git a/usr.sbin/rpcbind/rpcbind.c b/usr.sbin/rpcbind/rpcbind.c index 2ddf2c084f8d..8e93160f7a05 100644 --- a/usr.sbin/rpcbind/rpcbind.c +++ b/usr.sbin/rpcbind/rpcbind.c @@ -342,8 +342,8 @@ init_transport(struct netconfig *nconf) nconf->nc_netid); goto error; } - pml = (struct pmaplist *)malloc((u_int)sizeof (struct pmaplist)); - if (pml == (struct pmaplist *)NULL) { + pml = malloc(sizeof (struct pmaplist)); + if (pml == NULL) { syslog(LOG_ERR, "no memory!"); exit(1); } @@ -380,8 +380,8 @@ init_transport(struct netconfig *nconf) list_pml = pml; /* Add version 3 information */ - pml = (struct pmaplist *)malloc((u_int)sizeof (struct pmaplist)); - if (pml == (struct pmaplist *)NULL) { + pml = malloc(sizeof (struct pmaplist)); + if (pml == NULL) { syslog(LOG_ERR, "no memory!"); exit(1); } @@ -391,8 +391,8 @@ init_transport(struct netconfig *nconf) list_pml = pml; /* Add version 4 information */ - pml = (struct pmaplist *)malloc((u_int)sizeof (struct pmaplist)); - if (pml == (struct pmaplist *)NULL) { + pml = malloc (sizeof (struct pmaplist)); + if (pml == NULL) { syslog(LOG_ERR, "no memory!"); exit(1); } @@ -469,8 +469,8 @@ rbllist_add(rpcprog_t prog, rpcvers_t vers, struct netconfig *nconf, { rpcblist_ptr rbl; - rbl = (rpcblist_ptr)malloc((u_int)sizeof (rpcblist)); - if (rbl == (rpcblist_ptr)NULL) { + rbl = malloc(sizeof (rpcblist)); + if (rbl == NULL) { syslog(LOG_ERR, "no memory!"); exit(1); } |