From 573cdf8c8aff43c5cda2b3d090c7916bb3507a23 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Tue, 1 Jan 2019 11:29:05 -0800 Subject: fixes #841 Calling nng_stats_get() before creating socket panics While here fixed a spelling error in the description of the global statistics structure. --- src/core/stats.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/core/stats.c') diff --git a/src/core/stats.c b/src/core/stats.c index ffe6659c..afeafff6 100644 --- a/src/core/stats.c +++ b/src/core/stats.c @@ -336,6 +336,10 @@ int nng_stats_get(nng_stat **statp) { #ifdef NNG_ENABLE_STATS + int rv; + if ((rv = nni_init()) != 0) { + return (rv); + } return (nni_stat_snapshot(statp, &stats_root)); #else NNI_ARG_UNUSED(statp); @@ -413,7 +417,7 @@ nni_stat_sys_init(void) nni_mtx_init(&stats_lock); NNI_LIST_INIT(&stats_root.si_children, nni_stat_item, si_node); stats_root.si_name = ""; - stats_root.si_desc = "all statistsics"; + stats_root.si_desc = "all statistics"; #endif return (0); -- cgit v1.2.3-70-g09d2