Browse code

Fix goroutine leak on pull

Close the pipeWriter even if there was no error.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>

Tonis Tiigi authored on 2015/09/01 06:24:05
Showing 1 changed files
... ...
@@ -230,6 +230,9 @@ func (p *v2Puller) pullV2Tag(out io.Writer, tag, taggedName string) (verified bo
230 230
 			// set the error. All successive reads/writes will return with this
231 231
 			// error.
232 232
 			pipeWriter.CloseWithError(errors.New("download canceled"))
233
+		} else {
234
+			// If no error then just close the pipe.
235
+			pipeWriter.Close()
233 236
 		}
234 237
 	}()
235 238