You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/31-Changelog.md
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,9 +9,13 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
9
9
10
10
# 1.12.0 (tbd)
11
11
12
-
### Enhancements
12
+
# 1.11.2 (tbd)
13
+
14
+
### Bugfixes
15
+
16
+
*[#375](https://github.com/Icinga/icinga-powershell-plugins/pull/375) Fixes a memory leak on the Icinga EventLog provider for fetching Windows EventLog information
Copy file name to clipboardExpand all lines: provider/eventlog/Get-IcingaEventLog.psm1
+22-3Lines changed: 22 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -61,6 +61,8 @@ function Get-IcingaEventLog()
61
61
62
62
[hashtable]$UserFilter=@{ };
63
63
[hashtable]$SeverityFilter=@{ };
64
+
[array]$FilteredEvents=@();
65
+
[bool]$MemoryCleared=$FALSE;
64
66
65
67
if ($null-ne$IncludeUsername-And$IncludeUsername.Count-ne0) {
66
68
foreach ($entryin$IncludeUsername) {
@@ -137,7 +139,6 @@ function Get-IcingaEventLog()
137
139
}
138
140
139
141
if ($UserFilter.Count-ne0-Or$SeverityFilter.Count-ne0-Or$null-ne$IncludeEventId-Or$null-ne$ExcludeEventId-Or$null-ne$ExcludeUsername-Or$null-ne$ExcludeEntryType-Or$null-ne$ExcludeMessage-Or$null-ne$IncludeMessage-Or$null-ne$IncludeSource-Or$null-ne$ExcludeSource) {
140
-
$filteredEvents=@();
141
142
foreach ($eventin$events) {
142
143
143
144
if ($event.TimeCreated-lt$EventsAfter) {
@@ -231,10 +232,19 @@ function Get-IcingaEventLog()
231
232
continue;
232
233
}
233
234
234
-
$filteredEvents+=$event;
235
+
$FilteredEvents+=$event;
235
236
}
236
237
237
-
$events=$filteredEvents;
238
+
if ($null-ne$events) {
239
+
if ($null-ne ($events|Get-Member-Name 'Dispose')) {
240
+
$events.Dispose();
241
+
}
242
+
243
+
$events=$null;
244
+
$MemoryCleared=$TRUE;
245
+
}
246
+
247
+
$events=$FilteredEvents;
238
248
}
239
249
240
250
$groupedEvents=@{
@@ -279,5 +289,14 @@ function Get-IcingaEventLog()
279
289
}
280
290
}
281
291
292
+
if ($MemoryCleared-eq$FALSE) {
293
+
if ($null-ne ($events|Get-Member-Name 'Dispose')) {
0 commit comments