From f1596eea5447a23526700432851d7c53139ee83f Mon Sep 17 00:00:00 2001 From: Jan Hajek Date: Fri, 10 Jul 2020 12:52:58 +0200 Subject: [PATCH] #xxx - added file close --- src/service/storage/handler.go | 1 + src/service/zipClient/test/zip_test.go | 1 + 2 files changed, 2 insertions(+) diff --git a/src/service/storage/handler.go b/src/service/storage/handler.go index 525d4dff..47300988 100644 --- a/src/service/storage/handler.go +++ b/src/service/storage/handler.go @@ -34,6 +34,7 @@ func New(config Config) (*Handler, error) { if err != nil { return nil, err } + defer f.Close() bytes, err := ioutil.ReadAll(f) if err != nil { diff --git a/src/service/zipClient/test/zip_test.go b/src/service/zipClient/test/zip_test.go index 422da458..5805bc9d 100644 --- a/src/service/zipClient/test/zip_test.go +++ b/src/service/zipClient/test/zip_test.go @@ -261,6 +261,7 @@ func TestSymlink(t *testing.T) { fo, err := r.File[0].Open() Expect(err).ShouldNot(HaveOccurred()) + defer fo.Close() buf := new(bytes.Buffer) _, err = io.Copy(buf, fo) Expect(err).ShouldNot(HaveOccurred())