summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-08-25 14:42:12 -0400
committerGitHub <noreply@github.com>2021-08-25 14:42:12 -0400
commit49cfed756f5dfb6d9267eb29d31f651578c9037c (patch)
tree677b6acfee4b6fddc1b08d8181ce3552a5ccab68 /cmd
parentfefa0b32c74fc5d394a0e2bd5b4564bedb3ed15d (diff)
parent1dc6d14735eef1e51368103aefba3d7c704dcfe3 (diff)
downloadpodman-49cfed756f5dfb6d9267eb29d31f651578c9037c.tar.gz
podman-49cfed756f5dfb6d9267eb29d31f651578c9037c.tar.bz2
podman-49cfed756f5dfb6d9267eb29d31f651578c9037c.zip
Merge pull request #11103 from jwhonce/wip/bindings
Fix file descriptor leaks in bindings and add test
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/generate/kube.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/cmd/podman/generate/kube.go b/cmd/podman/generate/kube.go
index b4c9f9146..60b8f0af0 100644
--- a/cmd/podman/generate/kube.go
+++ b/cmd/podman/generate/kube.go
@@ -2,6 +2,7 @@ package pods
import (
"fmt"
+ "io"
"io/ioutil"
"os"
@@ -61,6 +62,10 @@ func kube(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
+ if r, ok := report.Reader.(io.ReadCloser); ok {
+ defer r.Close()
+ }
+
if cmd.Flags().Changed("filename") {
if _, err := os.Stat(kubeFile); err == nil {
return errors.Errorf("cannot write to %q; file exists", kubeFile)