From 213dc6110fda144326cc783c02f98a7886cfe4b3 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Sat, 1 Jan 2022 23:46:49 -0800 Subject: [PATCH] fixed fullbench freshCCtx scenario --- tests/fullbench.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/fullbench.c b/tests/fullbench.c index f610fef4c..31b3b6da1 100644 --- a/tests/fullbench.c +++ b/tests/fullbench.c @@ -230,14 +230,15 @@ local_ZSTD_compressStream_freshCCtx(const void* src, size_t srcSize, void* dst, size_t dstCapacity, void* payload) { - ZSTD_CCtx* const cctx = ZSTD_createCCtx(); - size_t r; - assert(cctx != NULL); + if (g_cstream != NULL) ZSTD_freeCCtx(g_cstream); + g_cstream = ZSTD_createCCtx(); + assert(g_cstream != NULL); - r = local_ZSTD_compressStream(src, srcSize, dst, dstCapacity, payload); - - ZSTD_freeCCtx(cctx); - return r; + { size_t const r = local_ZSTD_compressStream(src, srcSize, dst, dstCapacity, payload); + ZSTD_freeCCtx(g_cstream); + g_cstream = NULL; + return r; + } } static size_t