diff --git a/device.go b/device.go index 6af23c5..072a7d4 100644 --- a/device.go +++ b/device.go @@ -62,14 +62,17 @@ func (d *device) NewConnect(port int, timeout ...time.Duration) (InnerConn, erro if pkt, err = newClient.NewPlistPacket( newClient.NewConnectRequest(d.properties.DeviceID, port), ); err != nil { + newClient.Close() return nil, err } if err = newClient.SendPacket(pkt); err != nil { + newClient.Close() return nil, err } if _, err = newClient.ReceivePacket(); err != nil { + newClient.Close() return nil, err }