From 64c8dd325226569bfdb6114ddc9a752cbc4e4033 Mon Sep 17 00:00:00 2001 From: "yaoyao.xyy" Date: Tue, 2 Aug 2016 11:10:10 +0800 Subject: [PATCH] when deploy registry as a pull through cache ,function copeContent() may cause a socket leak when docker user canceled its pull operation. Signed-off-by: yaoyao.xyy --- registry/proxy/proxyblobstore.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/registry/proxy/proxyblobstore.go b/registry/proxy/proxyblobstore.go index 7a6d7ea2..6cd57213 100644 --- a/registry/proxy/proxyblobstore.go +++ b/registry/proxy/proxyblobstore.go @@ -55,6 +55,8 @@ func (pbs *proxyBlobStore) copyContent(ctx context.Context, dgst digest.Digest, return distribution.Descriptor{}, err } + defer remoteReader.Close() + _, err = io.CopyN(writer, remoteReader, desc.Size) if err != nil { return distribution.Descriptor{}, err