Merge pull request #3465 from oilbeater/fix/defer-in-loop

defer in loop may cause resource leak
pull/3482/head
Matthew Fisher 7 years ago committed by GitHub
commit 8009115d3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -193,10 +193,11 @@ func (g *TarGzExtractor) Extract(buffer *bytes.Buffer, targetDir string) error {
if err != nil {
return err
}
defer outFile.Close()
if _, err := io.Copy(outFile, tarReader); err != nil {
outFile.Close()
return err
}
outFile.Close()
default:
return fmt.Errorf("unknown type: %b in %s", header.Typeflag, header.Name)
}

Loading…
Cancel
Save