X Tutup
Skip to content

Commit 558fdc6

Browse files
committed
diff/walking: fix defer cleanup
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
1 parent 055c801 commit 558fdc6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

diff/walking/differ.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func (s *walkingDiff) Compare(ctx context.Context, lower, upper []mount.Mount, o
8080

8181
var ocidesc ocispec.Descriptor
8282
if err := mount.WithTempMount(ctx, lower, func(lowerRoot string) error {
83-
return mount.WithTempMount(ctx, upper, func(upperRoot string) error {
83+
return mount.WithTempMount(ctx, upper, func(upperRoot string) (retErr error) {
8484
var newReference bool
8585
if config.Reference == "" {
8686
newReference = true
@@ -96,7 +96,7 @@ func (s *walkingDiff) Compare(ctx context.Context, lower, upper []mount.Mount, o
9696
return errors.Wrap(err, "failed to open writer")
9797
}
9898
defer func() {
99-
if err != nil {
99+
if retErr != nil {
100100
cw.Close()
101101
if newReference {
102102
if abortErr := s.store.Abort(ctx, config.Reference); abortErr != nil {

0 commit comments

Comments
 (0)
X Tutup