Close leaky file descriptors

This commit is contained in:
Matthew Holt 2015-10-30 15:38:55 -06:00
parent 38e66cf43a
commit 2c24056374

View file

@ -63,6 +63,7 @@ func GetOCSPForCert(bundle []byte) ([]byte, int, error) {
if err != nil { if err != nil {
return nil, OCSPUnknown, err return nil, OCSPUnknown, err
} }
defer resp.Body.Close()
issuerBytes, err := ioutil.ReadAll(resp.Body) issuerBytes, err := ioutil.ReadAll(resp.Body)
if err != nil { if err != nil {
@ -96,6 +97,7 @@ func GetOCSPForCert(bundle []byte) ([]byte, int, error) {
if err != nil { if err != nil {
return nil, OCSPUnknown, err return nil, OCSPUnknown, err
} }
defer req.Body.Close()
ocspResBytes, err := ioutil.ReadAll(req.Body) ocspResBytes, err := ioutil.ReadAll(req.Body)
ocspRes, err := ocsp.ParseResponse(ocspResBytes, issuerCert) ocspRes, err := ocsp.ParseResponse(ocspResBytes, issuerCert)