Skip to content

Commit

Permalink
Fix leak with defer without func
Browse files Browse the repository at this point in the history
  • Loading branch information
Марк Булатов committed Feb 4, 2025
1 parent 85107ac commit 2f4a8b6
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions pkg/chunked/storage_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,7 @@ func (c *chunkedDiffer) convertTarToZstdChunked(destDirectory string, payload *o
return 0, nil, "", nil, err
}

defer func() {
if err := diff.Close(); err != nil {
return 0, nil, "", nil, err
}
}()
defer diff.Close()

fd, err := unix.Open(destDirectory, unix.O_TMPFILE|unix.O_RDWR|unix.O_CLOEXEC, 0o600)
if err != nil {
Expand Down

0 comments on commit 2f4a8b6

Please sign in to comment.