Don't forget to close that FD!

This commit is contained in:
Kalle Carlbark 2019-09-16 15:12:58 +02:00
parent 4f2515ba26
commit 8739969a7d
No known key found for this signature in database
GPG key ID: 3FC0C93C5A5A0670
2 changed files with 3 additions and 0 deletions

View file

@ -218,6 +218,7 @@ func (n *NetBox) ListDevices(d *Dcim_Devices_List, f *DeviceFilter) error {
if err != nil {
return err
}
defer response.Body.Close()
if response.StatusCode != http.StatusOK {
return errors.Errorf("Error: response was: %d should be %d (%s)\n", response.StatusCode, http.StatusOK, deviceurl)

View file

@ -137,6 +137,7 @@ func (n *NetBox) ListInterfaces(i *Dcim_Interfaces_List, f *InterfaceFilter) err
if err != nil {
return err
}
defer response.Body.Close()
if response.StatusCode != http.StatusOK {
return errors.Errorf("Error: response was: %d should be %d\n", response.StatusCode, http.StatusOK)
@ -178,6 +179,7 @@ func (n *NetBox) CreateInterfaces(i *Dcim_Interfaces_Create) error {
if err != nil {
return err
}
defer response.Body.Close()
if response.StatusCode == http.StatusCreated {
return nil