Commit f862963b authored by Ömer Sinan Ağacan's avatar Ömer Sinan Ağacan Committed by Marge Bot

rts: Properly free the RTSSummaryStats structure

`stat_exit` always allocates a `RTSSummaryStats` but only sometimes
frees it, which casues leaks. With this patch we unconditionally free
the structure, fixing the leak.

Fixes #16584
parent cc495d57
Pipeline #5440 failed with stages
in 237 minutes and 55 seconds
...@@ -657,11 +657,8 @@ static void init_RTSSummaryStats(RTSSummaryStats* sum) ...@@ -657,11 +657,8 @@ static void init_RTSSummaryStats(RTSSummaryStats* sum)
static void free_RTSSummaryStats(RTSSummaryStats * sum) static void free_RTSSummaryStats(RTSSummaryStats * sum)
{ {
if (!sum) { return; } stgFree(sum->gc_summary_stats);
if (!sum->gc_summary_stats) { sum->gc_summary_stats = NULL;
stgFree(sum->gc_summary_stats);
sum->gc_summary_stats = NULL;
}
} }
static void report_summary(const RTSSummaryStats* sum) static void report_summary(const RTSSummaryStats* sum)
...@@ -1257,11 +1254,12 @@ stat_exit (void) ...@@ -1257,11 +1254,12 @@ stat_exit (void)
} }
} }
free_RTSSummaryStats(&sum);
statsFlush(); statsFlush();
statsClose(); statsClose();
} }
free_RTSSummaryStats(&sum);
if (GC_coll_cpu) { if (GC_coll_cpu) {
stgFree(GC_coll_cpu); stgFree(GC_coll_cpu);
GC_coll_cpu = NULL; GC_coll_cpu = NULL;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment