summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2013-05-29 17:59:42 +0200
committerDaniel Borkmann <dborkman@redhat.com>2013-05-29 17:59:42 +0200
commiteaffb9259e7c16ec610cbb5e2f9b0db869203a60 (patch)
treec048eef886fd80074873e18b5531e82a035e2086
parente9cb93501216c891347481a032ac058cc3deea2b (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.c7
1 files changed, 7 insertions, 0 deletions
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);