From eaffb9259e7c16ec610cbb5e2f9b0db869203a60 Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Wed, 29 May 2013 17:59:42 +0200 Subject: 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 --- ifpps.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'ifpps.c') diff --git a/ifpps.c b/ifpps.c index 3dbb337..b7aea30 100644 --- a/ifpps.c +++ b/ifpps.c @@ -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); -- cgit v1.2.3-54-g00ecf