forked from TrueCloudLab/restic
Close Reader after read
This commit is contained in:
parent
215fb982c6
commit
d3fe4a7f6d
1 changed files with 3 additions and 0 deletions
|
@ -112,18 +112,21 @@ func (s Server) LoadJSON(t backend.Type, blob Blob, item interface{}) error {
|
||||||
func (s Server) LoadJSONID(t backend.Type, storageID backend.ID, item interface{}) error {
|
func (s Server) LoadJSONID(t backend.Type, storageID backend.ID, item interface{}) error {
|
||||||
// read
|
// read
|
||||||
rd, err := s.GetReader(t, storageID)
|
rd, err := s.GetReader(t, storageID)
|
||||||
|
defer rd.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// decrypt
|
// decrypt
|
||||||
decryptRd, err := s.key.DecryptFrom(rd)
|
decryptRd, err := s.key.DecryptFrom(rd)
|
||||||
|
defer decryptRd.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// unzip
|
// unzip
|
||||||
unzipRd, err := zlib.NewReader(decryptRd)
|
unzipRd, err := zlib.NewReader(decryptRd)
|
||||||
|
defer unzipRd.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue