2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-22 21:05:10 +00:00

Close Reader after read

This commit is contained in:
Alexander Neumann 2015-02-17 23:37:45 +01:00
parent 215fb982c6
commit d3fe4a7f6d

View File

@ -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
}