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