From 21b358c74211cafbcd2ec0cbef6d8a46e0378b00 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Fri, 10 Feb 2017 20:49:46 +0100 Subject: [PATCH] backend tests: Always close reader --- src/restic/backend/test/tests.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/restic/backend/test/tests.go b/src/restic/backend/test/tests.go index a6105f9e9..5c11d2e4b 100644 --- a/src/restic/backend/test/tests.go +++ b/src/restic/backend/test/tests.go @@ -245,21 +245,25 @@ func TestLoad(t testing.TB) { buf, err := ioutil.ReadAll(rd) if err != nil { t.Errorf("Load(%d, %d) ReadAll() returned unexpected error: %v", l, o, err) + rd.Close() continue } if l <= len(d) && len(buf) != l { t.Errorf("Load(%d, %d) wrong number of bytes read: want %d, got %d", l, o, l, len(buf)) + rd.Close() continue } if l > len(d) && len(buf) != len(d) { t.Errorf("Load(%d, %d) wrong number of bytes read for overlong read: want %d, got %d", l, o, l, len(buf)) + rd.Close() continue } if !bytes.Equal(buf, d) { t.Errorf("Load(%d, %d) returned wrong bytes", l, o) + rd.Close() continue }