From 6fe3ff90cd86d539371403381f6c580fc097e689 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 19 May 2019 14:33:36 -0700 Subject: fix #946 Use after free in TLS This also introduces a more efficient reference counting usage based on atomics, rather than locks. --- src/core/stats.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/stats.c') diff --git a/src/core/stats.c b/src/core/stats.c index f3f969c3..247e7ab4 100644 --- a/src/core/stats.c +++ b/src/core/stats.c @@ -152,13 +152,13 @@ nni_stat_init_atomic(nni_stat_item *stat, const char *name, const char *desc) void nni_stat_inc_atomic(nni_stat_item *stat, uint64_t inc) { - nni_atomic_inc64(&stat->si_atomic, inc); + nni_atomic_add64(&stat->si_atomic, inc); } void nni_stat_dec_atomic(nni_stat_item *stat, uint64_t inc) { - nni_atomic_dec64(&stat->si_atomic, inc); + nni_atomic_sub64(&stat->si_atomic, inc); } #endif -- cgit v1.2.3-70-g09d2