c8d/import: Don't close compressed stream twice

The compressor is already closed a few lines below and there's no error
returns between so the defer is not needed.

Calling Close twice on a writerCloserWrapper is unsafe as it causes it
to put the same buffer to the pool multiple times.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Paweł Gronowski 2023-09-07 10:17:15 +02:00
parent 62725ab277
commit 1cb45e582c
No known key found for this signature in database
GPG key ID: B85EFCFE26DEF92A

View file

@ -258,7 +258,6 @@ func compressAndWriteBlob(ctx context.Context, cs content.Store, compression arc
if err != nil {
return "", "", errdefs.InvalidParameter(err)
}
defer compressor.Close()
writeChan := make(chan digest.Digest)
// Start copying the blob to the content store from the pipe.