perf-counter: initialize perf counter shash before use
authorAndy Zhou <azhou@nicira.com>
Wed, 15 Jul 2015 20:22:00 +0000 (13:22 -0700)
committerAndy Zhou <azhou@nicira.com>
Fri, 17 Jul 2015 19:24:22 +0000 (12:24 -0700)
Private variable perf_counters needs to be initialized before
use. Otherwise,  perf_counter_init() call will cause crashes.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
lib/perf-counter.c

index 8c859cc..62e2d76 100644 (file)
@@ -31,7 +31,7 @@
 #include "shash.h"
 #include "util.h"
 
-static struct shash perf_counters;
+static struct shash perf_counters = SHASH_INITIALIZER(&perf_counters);
 static int fd__ = 0;
 
 uint64_t