diff options
Diffstat (limited to 'procps/top.c')
-rw-r--r-- | procps/top.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/procps/top.c b/procps/top.c index 89f9d23f4..5c41e8e10 100644 --- a/procps/top.c +++ b/procps/top.c | |||
@@ -979,6 +979,9 @@ static unsigned handle_input(unsigned scan_mask, duration_t interval) | |||
979 | IF_FEATURE_TOPMEM(&& scan_mask != TOPMEM_MASK) | 979 | IF_FEATURE_TOPMEM(&& scan_mask != TOPMEM_MASK) |
980 | ) { | 980 | ) { |
981 | scan_mask ^= PSSCAN_TASKS; | 981 | scan_mask ^= PSSCAN_TASKS; |
982 | free(prev_hist); | ||
983 | prev_hist = NULL; | ||
984 | prev_hist_count = 0; | ||
982 | continue; | 985 | continue; |
983 | } | 986 | } |
984 | # endif | 987 | # endif |
@@ -1000,10 +1003,10 @@ static unsigned handle_input(unsigned scan_mask, duration_t interval) | |||
1000 | # if ENABLE_FEATURE_TOPMEM | 1003 | # if ENABLE_FEATURE_TOPMEM |
1001 | if (c == 's') { | 1004 | if (c == 's') { |
1002 | scan_mask = TOPMEM_MASK; | 1005 | scan_mask = TOPMEM_MASK; |
1006 | sort_field = (sort_field + 1) % NUM_SORT_FIELD; | ||
1003 | free(prev_hist); | 1007 | free(prev_hist); |
1004 | prev_hist = NULL; | 1008 | prev_hist = NULL; |
1005 | prev_hist_count = 0; | 1009 | prev_hist_count = 0; |
1006 | sort_field = (sort_field + 1) % NUM_SORT_FIELD; | ||
1007 | continue; | 1010 | continue; |
1008 | } | 1011 | } |
1009 | # endif | 1012 | # endif |
@@ -1229,7 +1232,7 @@ int top_main(int argc UNUSED_PARAM, char **argv) | |||
1229 | #endif | 1232 | #endif |
1230 | } /* end of "while we read /proc" */ | 1233 | } /* end of "while we read /proc" */ |
1231 | if (ntop == 0) { | 1234 | if (ntop == 0) { |
1232 | bb_error_msg("no process info in /proc"); | 1235 | bb_simple_error_msg("no process info in /proc"); |
1233 | break; | 1236 | break; |
1234 | } | 1237 | } |
1235 | 1238 | ||