From: jinyaoguo Date: Sun, 25 May 2025 19:21:23 +0000 (-0400) Subject: Fix memory leak in function benchMem X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F4392%2Fhead;p=thirdparty%2Fzstd.git Fix memory leak in function benchMem `speedPerRound` is allocated at the start of benchMem to collect per-round speeds, but is never freed, causing a leak on each invocation. --- diff --git a/contrib/largeNbDicts/largeNbDicts.c b/contrib/largeNbDicts/largeNbDicts.c index 6502f1227..6b6cc34ca 100644 --- a/contrib/largeNbDicts/largeNbDicts.c +++ b/contrib/largeNbDicts/largeNbDicts.c @@ -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