From 27186778b84873d81b99089c60d95a808ae84172 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Wed, 8 Apr 2020 22:08:39 +0200 Subject: [PATCH] fuzz: allow uninitialized stats api --- src/counters.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/counters.c b/src/counters.c index 3b93a3746c..dda69ad526 100644 --- a/src/counters.c +++ b/src/counters.c @@ -147,7 +147,7 @@ static void StatsPublicThreadContextCleanup(StatsPublicThreadContext *t) void StatsAddUI64(ThreadVars *tv, uint16_t id, uint64_t x) { StatsPrivateThreadContext *pca = &tv->perf_private_ctx; -#ifdef UNITTESTS +#if defined (UNITTESTS) || defined (FUZZ) if (pca->initialized == 0) return; #endif @@ -168,7 +168,7 @@ void StatsAddUI64(ThreadVars *tv, uint16_t id, uint64_t x) void StatsIncr(ThreadVars *tv, uint16_t id) { StatsPrivateThreadContext *pca = &tv->perf_private_ctx; -#ifdef UNITTESTS +#if defined (UNITTESTS) || defined (FUZZ) if (pca->initialized == 0) return; #endif @@ -190,7 +190,7 @@ void StatsIncr(ThreadVars *tv, uint16_t id) void StatsSetUI64(ThreadVars *tv, uint16_t id, uint64_t x) { StatsPrivateThreadContext *pca = &tv->perf_private_ctx; -#ifdef UNITTESTS +#if defined (UNITTESTS) || defined (FUZZ) if (pca->initialized == 0) return; #endif @@ -996,7 +996,7 @@ uint16_t StatsRegisterMaxCounter(const char *name, struct ThreadVars_ *tv) */ uint16_t StatsRegisterGlobalCounter(const char *name, uint64_t (*Func)(void)) { -#ifdef UNITTESTS +#if defined (UNITTESTS) || defined (FUZZ) if (stats_ctx == NULL) return 0; #else -- 2.47.2