Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/ifconfig Suggested by Christos:
details: https://anonhg.NetBSD.org/src/rev/ea5db31a2b5f
branches: trunk
changeset: 450687:ea5db31a2b5f
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Mon Apr 22 10:44:55 2019 +0000
description:
Suggested by Christos:
- Dont' cast malloc()'s return value.
- Use calloc() instead of malloc().
diffstat:
sbin/ifconfig/media.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diffs (20 lines):
diff -r 23610bb58e35 -r ea5db31a2b5f sbin/ifconfig/media.c
--- a/sbin/ifconfig/media.c Mon Apr 22 09:30:09 2019 +0000
+++ b/sbin/ifconfig/media.c Mon Apr 22 10:44:55 2019 +0000
@@ -1,6 +1,6 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: media.c,v 1.7 2016/09/14 11:46:43 roy Exp $");
+__RCSID("$NetBSD: media.c,v 1.8 2019/04/22 10:44:55 msaitoh Exp $");
#endif /* not lint */
#include <assert.h>
@@ -374,7 +374,7 @@
/* Interface link status is queried through SIOCGIFMEDIA.
* Not all interfaces have actual media. */
if (ifmr.ifm_count != 0) {
- media_list = (int *)malloc(ifmr.ifm_count * sizeof(int));
+ media_list = calloc(ifmr.ifm_count, sizeof(int));
if (media_list == NULL)
err(EXIT_FAILURE, "malloc");
ifmr.ifm_ulist = media_list;
Home |
Main Index |
Thread Index |
Old Index