diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2013-05-29 17:59:42 +0200 |
---|---|---|
committer | Daniel Borkmann <dborkman@redhat.com> | 2013-05-29 17:59:42 +0200 |
commit | eaffb9259e7c16ec610cbb5e2f9b0db869203a60 (patch) | |
tree | c048eef886fd80074873e18b5531e82a035e2086 | |
parent | e9cb93501216c891347481a032ac058cc3deea2b (diff) |
ifpps: fix segfault in terminal mode
Introduced by commit 0e47d1d5011f ("ifpps: Don't assume a maximum of
32 CPUs"). Also update term_main with initial allocation of CPU data.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
-rw-r--r-- | ifpps.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -992,6 +992,13 @@ static void term_csv_header(const char *ifname, const struct ifstat *abs, static int term_main(const char *ifname, uint64_t ms_interval) { int first = 1; + int cpus = get_number_cpus(); + + stats_alloc(&stats_old, cpus); + stats_alloc(&stats_new, cpus); + stats_alloc(&stats_delta, cpus); + + cpu_hits = xzmalloc(cpus * sizeof(*cpu_hits)); do { stats_sample_generic(ifname, ms_interval); |