summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/iostat/iostat.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/iostat/iostat.c b/usr.sbin/iostat/iostat.c
index e54e29c..2ed8049 100644
--- a/usr.sbin/iostat/iostat.c
+++ b/usr.sbin/iostat/iostat.c
@@ -735,9 +735,10 @@ devstats(int perf_select, long double etime, int havelast)
}
if (xflag > 0) {
- asprintf(&devname, "%s%d",
+ if (asprintf(&devname, "%s%d",
cur.dinfo->devices[di].device_name,
- cur.dinfo->devices[di].unit_number);
+ cur.dinfo->devices[di].unit_number) == 1)
+ errx(1, "asprintf() failed (out of memory?)");
/*
* If zflag is set, skip any devices with zero I/O.
*/
@@ -781,6 +782,7 @@ devstats(int perf_select, long double etime, int havelast)
}
printf("\n");
}
+ free(devname);
} else if (oflag > 0) {
int msdig = (ms_per_transaction < 100.0) ? 1 : 0;
OpenPOWER on IntegriCloud