Skip to content

Commit 23f800d

Browse files
committed
Correct error handling
Signed-off-by: Prasad Ghangal <[email protected]>
1 parent cdcb8cd commit 23f800d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/hostpath/snapshotmetadata.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ func (cb *fileBlockReader) Close() error {
9191
func openFiles(basePath, targetPath string) (base, target *os.File, err error) {
9292
target, err = os.Open(targetPath)
9393
if err != nil {
94-
base.Close()
9594
return nil, nil, err
9695
}
9796
if basePath == "" {
9897
return nil, target, nil
9998
}
10099
base, err = os.Open(basePath)
101100
if err != nil {
101+
target.Close()
102102
return nil, nil, err
103103
}
104104

0 commit comments

Comments
 (0)