36 lines
1.3 KiB
Diff
36 lines
1.3 KiB
Diff
From d8fe98edc34c3db927092c09af0941ca052996b9 Mon Sep 17 00:00:00 2001
|
|
From: Iceber Gu <wei.cai-nat@daocloud.io>
|
|
Date: Tue, 1 Jun 2021 18:24:47 +0800
|
|
Subject: [PATCH] diff/walking: fix defer cleanup
|
|
|
|
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
|
|
---
|
|
diff/walking/differ.go | 4 ++--
|
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/diff/walking/differ.go b/diff/walking/differ.go
|
|
index 1c82860d7..988af3ccb 100644
|
|
--- a/diff/walking/differ.go
|
|
+++ b/diff/walking/differ.go
|
|
@@ -80,7 +80,7 @@ func (s *walkingDiff) Compare(ctx context.Context, lower, upper []mount.Mount, o
|
|
|
|
var ocidesc ocispec.Descriptor
|
|
if err := mount.WithTempMount(ctx, lower, func(lowerRoot string) error {
|
|
- return mount.WithTempMount(ctx, upper, func(upperRoot string) error {
|
|
+ return mount.WithTempMount(ctx, upper, func(upperRoot string) (retErr error) {
|
|
var newReference bool
|
|
if config.Reference == "" {
|
|
newReference = true
|
|
@@ -96,7 +96,7 @@ func (s *walkingDiff) Compare(ctx context.Context, lower, upper []mount.Mount, o
|
|
return errors.Wrap(err, "failed to open writer")
|
|
}
|
|
defer func() {
|
|
- if err != nil {
|
|
+ if retErr != nil {
|
|
cw.Close()
|
|
if newReference {
|
|
if err := s.store.Abort(ctx, config.Reference); err != nil {
|
|
--
|
|
2.33.0
|
|
|