diff options
Diffstat (limited to 'components/swap.c')
| -rw-r--r-- | components/swap.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/components/swap.c b/components/swap.c index f270d93..dbd2747 100644 --- a/components/swap.c +++ b/components/swap.c @@ -112,7 +112,7 @@ int rnswap, nswap, i; if ((nswap = swapctl(SWAP_NSWAP, 0, 0)) < 1) { - warn("swaptctl 'SWAP_NSWAP':"); + warn("swapctl 'SWAP_NSWAP':"); return 1; } if (!(fsep = sep = calloc(nswap, sizeof(*sep)))) { @@ -120,11 +120,13 @@ return 1; } if ((rnswap = swapctl(SWAP_STATS, (void *)sep, nswap)) < 0) { - warn("swapctl 'SWAP_STATA':"); + warn("swapctl 'SWAP_STATS':"); + free(fsep); return 1; } if (nswap != rnswap) { warn("getstats: SWAP_STATS != SWAP_NSWAP"); + free(fsep); return 1; } @@ -132,8 +134,8 @@ *used = 0; for (i = 0; i < rnswap; i++) { - *total += sep->se_nblks >> 1; - *used += sep->se_inuse >> 1; + *total += sep[i].se_nblks >> 1; + *used += sep[i].se_inuse >> 1; } free(fsep); |
