From 85be7b39aca8b66a48058fe20d869e67347fb6b1 Mon Sep 17 00:00:00 2001 From: Egon Elbre Date: Wed, 22 Apr 2020 20:06:56 +0300 Subject: [PATCH] Call cleanup funcs when skip fails (#9417) --- cmd/object-api-utils.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/object-api-utils.go b/cmd/object-api-utils.go index 1416fe9dc..ebfaf33f2 100644 --- a/cmd/object-api-utils.go +++ b/cmd/object-api-utils.go @@ -649,6 +649,10 @@ func NewGetObjectReader(rs *HTTPRangeSpec, oi ObjectInfo, opts ObjectOptions, cl // Apply the skipLen and limit on the decompressed stream. err = s2Reader.Skip(decOff) if err != nil { + // Call the cleanup funcs + for i := len(cFns) - 1; i >= 0; i-- { + cFns[i]() + } return nil, err }