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 {
|
||||
// read
|
||||
rd, err := s.GetReader(t, storageID)
|
||||
defer rd.Close()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// decrypt
|
||||
decryptRd, err := s.key.DecryptFrom(rd)
|
||||
defer decryptRd.Close()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// unzip
|
||||
unzipRd, err := zlib.NewReader(decryptRd)
|
||||
defer unzipRd.Close()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue