From cf7f9b77de788d85b2b8d849b6483fc9dede812b Mon Sep 17 00:00:00 2001 From: James Pickett Date: Wed, 11 Sep 2024 10:12:13 -0700 Subject: [PATCH] re-add wmi releases --- ee/wmi/wmi.go | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/ee/wmi/wmi.go b/ee/wmi/wmi.go index ac4e29200..b46a5edb8 100644 --- a/ee/wmi/wmi.go +++ b/ee/wmi/wmi.go @@ -36,7 +36,6 @@ import ( "context" "fmt" "log/slog" - "runtime" "github.com/go-ole/go-ole" "github.com/go-ole/go-ole/oleutil" @@ -155,12 +154,7 @@ func Query(ctx context.Context, slogger *slog.Logger, className string, properti defer serviceRaw.Clear() service := serviceRaw.ToIDispatch() - if runtime.GOARCH != "arm64" { - // calling service.Release() and the serviceRaw.Clear() (or the reverse) causes - // a panic on arm64 (Exception 0xc0000005: Access Violation). The hunch is that on arm64 - // one clears the memory of the other. - defer service.Release() - } + defer service.Release() slogger.Log(ctx, slog.LevelDebug, "running WMI query", @@ -175,12 +169,7 @@ func Query(ctx context.Context, slogger *slog.Logger, className string, properti defer resultRaw.Clear() result := resultRaw.ToIDispatch() - if runtime.GOARCH != "arm64" { - // calling result.Release() and then resultRaw.Clear() (or the reverse) causes - // a panic on arm64 (Exception 0xc0000005: Access Violation). The hunch is that on arm64 - // one clears the memory of the other. - defer result.Release() - } + defer result.Release() if err := oleutil.ForEach(result, handler.HandleVariant); err != nil { return nil, fmt.Errorf("ole foreach: %w", err)