From 6e5d9523d6273368df6377a4db98a9533d11505c Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Thu, 20 Aug 2015 22:32:43 +0000 Subject: Do not cast result of malloc/calloc/realloc* if stdlib.h is in scope ok krw millert --- usr.bin/finger/finger.c | 4 ++-- usr.bin/finger/sprint.c | 4 ++-- usr.bin/finger/util.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'usr.bin/finger') diff --git a/usr.bin/finger/finger.c b/usr.bin/finger/finger.c index e2e2134e49d..5ec24c144bf 100644 --- a/usr.bin/finger/finger.c +++ b/usr.bin/finger/finger.c @@ -1,4 +1,4 @@ -/* $OpenBSD: finger.c,v 1.19 2015/01/16 06:40:07 deraadt Exp $ */ +/* $OpenBSD: finger.c,v 1.20 2015/08/20 22:32:41 deraadt Exp $ */ /* * Copyright (c) 1989 The Regents of the University of California. @@ -194,7 +194,7 @@ userlist(int argc, char **argv) struct passwd *pw; int dolocal, *used; - if (!(used = (int *)calloc((u_int)argc, (u_int)sizeof(int)))) + if (!(used = calloc((u_int)argc, (u_int)sizeof(int)))) err(2, "malloc"); /* pull out all network requests */ diff --git a/usr.bin/finger/sprint.c b/usr.bin/finger/sprint.c index 81e23dd2f88..ffed24b9c0a 100644 --- a/usr.bin/finger/sprint.c +++ b/usr.bin/finger/sprint.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sprint.c,v 1.15 2015/03/15 00:41:28 millert Exp $ */ +/* $OpenBSD: sprint.c,v 1.16 2015/08/20 22:32:41 deraadt Exp $ */ /* * Copyright (c) 1989 The Regents of the University of California. @@ -132,7 +132,7 @@ sort(void) PERSON *pn, **lp; PERSON **list; - if (!(list = (PERSON **)calloc((u_int)entries, sizeof(PERSON *)))) + if (!(list = calloc((u_int)entries, sizeof(PERSON *)))) err(1, "malloc"); for (lp = list, pn = phead; pn != NULL; pn = pn->next) *lp++ = pn; diff --git a/usr.bin/finger/util.c b/usr.bin/finger/util.c index 6e845c1ed71..0a1ba56a721 100644 --- a/usr.bin/finger/util.c +++ b/usr.bin/finger/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.30 2015/01/16 06:40:07 deraadt Exp $ */ +/* $OpenBSD: util.c,v 1.31 2015/08/20 22:32:41 deraadt Exp $ */ /* * Copyright (c) 1989 The Regents of the University of California. @@ -302,7 +302,7 @@ palloc(void) { PERSON *p; - if ((p = (PERSON *)malloc((u_int) sizeof(PERSON))) == NULL) + if ((p = malloc((u_int) sizeof(PERSON))) == NULL) err(1, "malloc"); return (p); } @@ -312,7 +312,7 @@ walloc(PERSON *pn) { WHERE *w; - if ((w = (WHERE *)malloc((u_int) sizeof(WHERE))) == NULL) + if ((w = malloc((u_int) sizeof(WHERE))) == NULL) err(1, "malloc"); if (pn->whead == NULL) pn->whead = pn->wtail = w; -- cgit v1.2.3