mirror of
https://github.com/hashicorp/vault.git
synced 2026-02-18 18:38:08 -05:00
VAULT-20403 fix incorrectly deferred resource closure in debug command (#26167)
* VAULT-20403 fix incorrectly deferred resource closure in debug command * VAULT-20403 changelog
This commit is contained in:
parent
5fac327dae
commit
2a33300003
2 changed files with 6 additions and 2 deletions
3
changelog/26167.txt
Normal file
3
changelog/26167.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
```release-note:bug
|
||||
cli/debug: Fix resource leak in CLI debug command.
|
||||
```
|
||||
|
|
@ -687,17 +687,18 @@ func (c *DebugCommand) collectHostInfo(ctx context.Context) {
|
|||
return
|
||||
}
|
||||
if resp != nil {
|
||||
defer resp.Body.Close()
|
||||
|
||||
secret, err := api.ParseSecret(resp.Body)
|
||||
if err != nil {
|
||||
c.captureError("host", err)
|
||||
resp.Body.Close()
|
||||
return
|
||||
}
|
||||
if secret != nil && secret.Data != nil {
|
||||
hostEntry := secret.Data
|
||||
c.hostInfoCollection = append(c.hostInfoCollection, hostEntry)
|
||||
}
|
||||
|
||||
resp.Body.Close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue