From 6aefcf98c1b8279d8baa21a6ff5e43bec214d85e Mon Sep 17 00:00:00 2001 From: okozachenko Date: Thu, 13 Aug 2020 22:22:12 +0300 Subject: [PATCH] Free domains Change-Id: Ide1743bbae89f41d2d6f62195ba4f7347d43cfda --- collectors/domain_stats.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/collectors/domain_stats.go b/collectors/domain_stats.go index 25eb53e..012ca70 100644 --- a/collectors/domain_stats.go +++ b/collectors/domain_stats.go @@ -340,6 +340,15 @@ func (c *DomainStatsCollector) Collect(ch chan<- prometheus.Metric) { 0, ) + defer func(stats []libvirt.DomainStats) { + for _, stat := range stats { + err := stat.Domain.Free() + if err != nil { + log.Errorln(err) + } + } + }(stats) + if err != nil { log.Errorln(err) return