Skip to content

Commit

Permalink
Merge pull request #706 from zvier/master
Browse files Browse the repository at this point in the history
fix goroutine leak with close tatLogger in a defer clause
  • Loading branch information
giuseppe authored Aug 31, 2020
2 parents bc034cc + 5cec343 commit 250e2aa
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 250e2aa

Please sign in to comment.