diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-08-25 14:42:12 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-25 14:42:12 -0400 |
commit | 49cfed756f5dfb6d9267eb29d31f651578c9037c (patch) | |
tree | 677b6acfee4b6fddc1b08d8181ce3552a5ccab68 /pkg/bindings/system/system.go | |
parent | fefa0b32c74fc5d394a0e2bd5b4564bedb3ed15d (diff) | |
parent | 1dc6d14735eef1e51368103aefba3d7c704dcfe3 (diff) | |
download | podman-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 'pkg/bindings/system/system.go')
-rw-r--r-- | pkg/bindings/system/system.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/pkg/bindings/system/system.go b/pkg/bindings/system/system.go index 310bcef15..719cde52e 100644 --- a/pkg/bindings/system/system.go +++ b/pkg/bindings/system/system.go @@ -31,6 +31,8 @@ func Events(ctx context.Context, eventChan chan entities.Event, cancelChan chan if err != nil { return err } + defer response.Body.Close() + if cancelChan != nil { go func() { <-cancelChan @@ -75,6 +77,8 @@ func Prune(ctx context.Context, options *PruneOptions) (*entities.SystemPruneRep if err != nil { return nil, err } + defer response.Body.Close() + return &report, response.Process(&report) } @@ -101,6 +105,7 @@ func Version(ctx context.Context, options *VersionOptions) (*entities.SystemVers if err != nil { return nil, err } + defer response.Body.Close() if err = response.Process(&component); err != nil { return nil, err @@ -141,5 +146,7 @@ func DiskUsage(ctx context.Context, options *DiskOptions) (*entities.SystemDfRep if err != nil { return nil, err } + defer response.Body.Close() + return &report, response.Process(&report) } |