summaryrefslogtreecommitdiff
path: root/pkg/bindings/volumes/volumes.go
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 /pkg/bindings/volumes/volumes.go
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 'pkg/bindings/volumes/volumes.go')
-rw-r--r--pkg/bindings/volumes/volumes.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/pkg/bindings/volumes/volumes.go b/pkg/bindings/volumes/volumes.go
index fb58a1d1f..56cf13ade 100644
--- a/pkg/bindings/volumes/volumes.go
+++ b/pkg/bindings/volumes/volumes.go
@@ -33,6 +33,8 @@ func Create(ctx context.Context, config entities.VolumeCreateOptions, options *C
if err != nil {
return nil, err
}
+ defer response.Body.Close()
+
return &v, response.Process(&v)
}
@@ -53,6 +55,8 @@ func Inspect(ctx context.Context, nameOrID string, options *InspectOptions) (*en
if err != nil {
return &inspect, err
}
+ defer response.Body.Close()
+
return &inspect, response.Process(&inspect)
}
@@ -74,6 +78,8 @@ func List(ctx context.Context, options *ListOptions) ([]*entities.VolumeListRepo
if err != nil {
return vols, err
}
+ defer response.Body.Close()
+
return vols, response.Process(&vols)
}
@@ -94,6 +100,8 @@ func Prune(ctx context.Context, options *PruneOptions) ([]*reports.PruneReport,
if err != nil {
return nil, err
}
+ defer response.Body.Close()
+
return pruned, response.Process(&pruned)
}
@@ -112,6 +120,8 @@ func Remove(ctx context.Context, nameOrID string, options *RemoveOptions) error
if err != nil {
return err
}
+ defer response.Body.Close()
+
return response.Process(nil)
}
@@ -125,5 +135,7 @@ func Exists(ctx context.Context, nameOrID string, options *ExistsOptions) (bool,
if err != nil {
return false, err
}
+ defer response.Body.Close()
+
return response.IsSuccess(), nil
}