aboutsummaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-05-17 04:03:54 -0700
committerGitHub <noreply@github.com>2020-05-17 04:03:54 -0700
commitbfcec3203ea517f408ad90d42789fb6eb62e7d81 (patch)
tree288ec49144e5eff437163334f9f69f05ed4ae050 /libpod
parent343ab99b39771b5084a231a2db8d3dc969f395f9 (diff)
parent5694aba9e3bd990b14802c20266b46611876efa5 (diff)
downloadpodman-bfcec3203ea517f408ad90d42789fb6eb62e7d81.tar.gz
podman-bfcec3203ea517f408ad90d42789fb6eb62e7d81.tar.bz2
podman-bfcec3203ea517f408ad90d42789fb6eb62e7d81.zip
Merge pull request #6231 from mheon/fix_coverity
Fix two coverity issues (unchecked null return)
Diffstat (limited to 'libpod')
-rw-r--r--libpod/boltdb_state_internal.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/libpod/boltdb_state_internal.go b/libpod/boltdb_state_internal.go
index 33ff0720f..21d55bf77 100644
--- a/libpod/boltdb_state_internal.go
+++ b/libpod/boltdb_state_internal.go
@@ -695,7 +695,10 @@ func (s *BoltState) addContainer(ctr *Container, pod *Pod) error {
return errors.Wrapf(define.ErrNoSuchVolume, "no volume with name %s found in database when adding container %s", vol.Name, ctr.ID())
}
- ctrDepsBkt := volDB.Bucket(volDependenciesBkt)
+ ctrDepsBkt, err := volDB.CreateBucketIfNotExists(volDependenciesBkt)
+ if err != nil {
+ return errors.Wrapf(err, "error creating volume %s dependencies bucket to add container %s", vol.Name, ctr.ID())
+ }
if depExists := ctrDepsBkt.Get(ctrID); depExists == nil {
if err := ctrDepsBkt.Put(ctrID, ctrID); err != nil {
return errors.Wrapf(err, "error adding container %s to volume %s dependencies", ctr.ID(), vol.Name)
@@ -890,6 +893,9 @@ func (s *BoltState) removeContainer(ctr *Container, pod *Pod, tx *bolt.Tx) error
}
ctrDepsBkt := volDB.Bucket(volDependenciesBkt)
+ if ctrDepsBkt == nil {
+ return errors.Wrapf(define.ErrInternal, "volume %s is missing container dependencies bucket, cannot remove container %s from dependencies", vol.Name, ctr.ID())
+ }
if depExists := ctrDepsBkt.Get(ctrID); depExists == nil {
if err := ctrDepsBkt.Delete(ctrID); err != nil {
return errors.Wrapf(err, "error deleting container %s dependency on volume %s", ctr.ID(), vol.Name)