From: jinyaoguo Date: Thu, 12 Jun 2025 23:52:58 +0000 (-0400) Subject: Ensure BMK_timedFnState is always freed in benchMem X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F4408%2Fhead;p=thirdparty%2Fzstd.git Ensure BMK_timedFnState is always freed in benchMem When an error occurs in BMK_isSuccessful_runOutcome, the code previously skipped the call to BMK_freeTimedFnState(tfs), leaking the allocated tfs object. Fiexed by calling BMK_freeTimedFnState(tfs) before goto _cleanOut. --- diff --git a/tests/fullbench.c b/tests/fullbench.c index 12a27f48c..5841e5db5 100644 --- a/tests/fullbench.c +++ b/tests/fullbench.c @@ -890,6 +890,7 @@ static int benchMem(unsigned scenarioID, if (!BMK_isSuccessful_runOutcome(bOutcome)) { DISPLAY("ERROR: Scenario %u: %s \n", scenarioID, ZSTD_getErrorName(BMK_extract_errorResult(bOutcome))); errorcode = 1; + BMK_freeTimedFnState(tfs); goto _cleanOut; }