From 076a9b5f8a123974bb9108258aa6a79d753bd7ae Mon Sep 17 00:00:00 2001 From: Aaron Lehmann Date: Thu, 18 Feb 2016 10:55:38 -0800 Subject: [PATCH] Close tarsplit gzip writer when creating tar-split.json.gz files during layer migration There is a missing call to Close on the gzip.Writer that is used to compress newly created tar-split files during layer migration. This can result in corrupt tar-split files that later cause docker push and docker save to fail. The Close call is necessary to flush buffered data to the stream. Fixes: #20104 Signed-off-by: Aaron Lehmann Upstream-commit: 1c05c65f6fbb5ea35608da259dfe4a6d211dbf82 Component: engine --- components/engine/layer/migration.go | 1 + 1 file changed, 1 insertion(+) diff --git a/components/engine/layer/migration.go b/components/engine/layer/migration.go index 9779ab7984..9141096743 100644 --- a/components/engine/layer/migration.go +++ b/components/engine/layer/migration.go @@ -127,6 +127,7 @@ func (ls *layerStore) checksumForGraphIDNoTarsplit(id, parent, newTarDataPath st } defer f.Close() mfz := gzip.NewWriter(f) + defer mfz.Close() metaPacker := storage.NewJSONPacker(mfz) packerCounter := &packSizeCounter{metaPacker, &size}