]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Ensure BMK_timedFnState is always freed in benchMem 4408/head
authorjinyaoguo <guo846@purdue.edu>
Thu, 12 Jun 2025 23:52:58 +0000 (19:52 -0400)
committerjinyaoguo <guo846@purdue.edu>
Thu, 12 Jun 2025 23:52:58 +0000 (19:52 -0400)
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.

tests/fullbench.c

index 12a27f48c037a531998bfa3e820b4b321dc4d1fb..5841e5db59a146acdb6071e8703e610ba959b1d3 100644 (file)
@@ -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;
             }