]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Fix memory leak in function benchMem 4392/head
authorjinyaoguo <guo846@purdue.edu>
Sun, 25 May 2025 19:21:23 +0000 (15:21 -0400)
committerjinyaoguo <guo846@purdue.edu>
Sun, 25 May 2025 19:21:23 +0000 (15:21 -0400)
`speedPerRound` is allocated at the start of benchMem to collect per-round speeds,
but is never freed, causing a leak on each invocation.

contrib/largeNbDicts/largeNbDicts.c

index 6502f12275bd28e12da52cf960f5ff9d60f8947d..6b6cc34ca1137f676ad67e089e2c66a6780e8e3a 100644 (file)
@@ -739,6 +739,8 @@ static int benchMem(slice_collection_t dstBlocks, slice_collection_t srcBlocks,
     /* BMK_benchTimedFn may not run exactly nbRounds iterations */
     double speedAggregated =
         aggregateData(speedPerRound, roundNb + 1, metricAggregatePref);
+    free(speedPerRound);
+    
     if (metricAggregatePref == fastest)
       DISPLAY("Fastest Speed : %.1f MB/s \n", speedAggregated);
     else