Skip to content

Commit

Permalink
fix: close calls on FindServers* should be deferred
Browse files Browse the repository at this point in the history
  • Loading branch information
sruehl committed Aug 22, 2023
1 parent a50f3ff commit 0443022
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func FindServers(ctx context.Context, endpoint string, opts ...Option) ([]*ua.Ap
if err := c.Dial(ctx); err != nil {
return nil, err
}
c.Close(ctx)
defer c.Close(ctx)
res, err := c.FindServers(ctx)
if err != nil {
return nil, err
Expand All @@ -55,7 +55,7 @@ func FindServersOnNetwork(ctx context.Context, endpoint string, opts ...Option)
if err := c.Dial(ctx); err != nil {
return nil, err
}
c.Close(ctx)
defer c.Close(ctx)
res, err := c.FindServersOnNetwork(ctx)
if err != nil {
return nil, err
Expand Down

0 comments on commit 0443022

Please sign in to comment.