Skip to content

Commit

Permalink
fix goroutine leak with close tatLogger in a defer clause
Browse files Browse the repository at this point in the history
Signed-off-by: Jeff Zvier <[email protected]>
  • Loading branch information
zvier committed Aug 31, 2020
1 parent bc034cc commit 5cec343
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion layers.go
Original file line number Diff line number Diff line change
Expand Up @@ -1342,6 +1342,7 @@ func (r *layerStore) ApplyDiff(to string, diff io.Reader) (size int64, err error
if err != nil {
return -1, err
}
defer idLogger.Close()
payload, err := asm.NewInputTarStream(io.TeeReader(uncompressed, io.MultiWriter(uncompressedCounter, idLogger)), metadata, storage.NewDiscardFilePutter())
if err != nil {
return -1, err
Expand All @@ -1356,7 +1357,6 @@ func (r *layerStore) ApplyDiff(to string, diff io.Reader) (size int64, err error
return -1, err
}
compressor.Close()
idLogger.Close()
if err == nil {
if err := os.MkdirAll(filepath.Dir(r.tspath(layer.ID)), 0700); err != nil {
return -1, err
Expand Down

0 comments on commit 5cec343

Please sign in to comment.