diff --git a/winpty_386.go b/winpty_386.go index 4aca764..a8bd856 100644 --- a/winpty_386.go +++ b/winpty_386.go @@ -8,6 +8,12 @@ import ( func createAgentCfg(flags uint32) (uintptr, error) { var errorPtr uintptr + + err := winpty_error_free.Find() // check if dll available + if err != nil { + return uintptr(0), err + } + defer winpty_error_free.Call(errorPtr) agentCfg, _, _ := winpty_config_new.Call( diff --git a/winpty_amd64.go b/winpty_amd64.go index 7e0bb5a..4740a84 100644 --- a/winpty_amd64.go +++ b/winpty_amd64.go @@ -8,6 +8,12 @@ import ( func createAgentCfg(flags uint32) (uintptr, error) { var errorPtr uintptr + + err := winpty_error_free.Find() // check if dll available + if err != nil { + return uintptr(0), err + } + defer winpty_error_free.Call(errorPtr) agentCfg, _, _ := winpty_config_new.Call(uintptr(flags), uintptr(unsafe.Pointer(errorPtr)))