mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-27 07:06:35 +00:00
initiate: close event log handle (#1654)
This commit is contained in:
@@ -83,6 +83,9 @@ func logToEventToLog(eType uint16, msg string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to open event log: %w", err)
|
return fmt.Errorf("failed to open event log: %w", err)
|
||||||
}
|
}
|
||||||
|
defer func(eventLog *eventlog.Log) {
|
||||||
|
_ = eventLog.Close()
|
||||||
|
}(eventLog)
|
||||||
|
|
||||||
p, err := windows.UTF16PtrFromString(msg)
|
p, err := windows.UTF16PtrFromString(msg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user