diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-07-21 09:21:57 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-07-21 09:21:57 +0000 |
commit | 9487b4e17bb4b5620730d0e97b93d398b2f24480 (patch) | |
tree | b098ac984d6c3d437e099486a07d98682fd6dfec /usr.bin/vmstat | |
parent | 940f91c9a647b6a5107db7e7135d75e3fba47891 (diff) |
plug mem leak; zero right amount of mem
Diffstat (limited to 'usr.bin/vmstat')
-rw-r--r-- | usr.bin/vmstat/dkstats.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/vmstat/dkstats.c b/usr.bin/vmstat/dkstats.c index fb81d8020f0..787a6781940 100644 --- a/usr.bin/vmstat/dkstats.c +++ b/usr.bin/vmstat/dkstats.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dkstats.c,v 1.13 2001/06/03 03:31:30 angelos Exp $ */ +/* $OpenBSD: dkstats.c,v 1.14 2001/07/21 09:21:56 deraadt Exp $ */ /* $NetBSD: dkstats.c,v 1.1 1996/05/10 23:19:27 thorpej Exp $ */ /* @@ -164,7 +164,7 @@ dkreadstats() err(1, NULL); if (sysctl(mib, 2, q, &size, NULL, 0) < 0) { warn("could not read hw.diskstats"); - bzero(q, dk_ndrive * sizeof(struct disk)); + bzero(q, dk_ndrive * sizeof(struct diskstats)); } for (i = 0; i < dk_ndrive; i++) { @@ -173,6 +173,7 @@ dkreadstats() cur.dk_bytes[i] = q[i].ds_bytes; timerset(&(q[i].ds_time), &(cur.dk_time[i])); } + free(q); size = sizeof(cur.cp_time); mib[0] = CTL_KERN; |