diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2019-04-12 10:57:10 +0200 |
---|---|---|
committer | Giuseppe Scrivano <gscrivan@redhat.com> | 2019-04-12 22:14:00 +0200 |
commit | 0a7b5b4e086ee4583b8550d80934dfa5c356ff64 (patch) | |
tree | b24ffcee237bfcd5f2c1016c995428d44f941ff8 /pkg/adapter | |
parent | 387d6012ba5ef0860df665132c1e3e3017405b8f (diff) | |
download | podman-0a7b5b4e086ee4583b8550d80934dfa5c356ff64.tar.gz podman-0a7b5b4e086ee4583b8550d80934dfa5c356ff64.tar.bz2 podman-0a7b5b4e086ee4583b8550d80934dfa5c356ff64.zip |
create: fix segfault if container name already exists
do not try to use ctr if there was an error. It fixes a segfault when
there is already a container with the same name.
regression introduced by: ba65301c955454e47c3893ca548f18a845a4c4a9
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'pkg/adapter')
-rw-r--r-- | pkg/adapter/containers.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg/adapter/containers.go b/pkg/adapter/containers.go index d4e8e30d9..2be4793a7 100644 --- a/pkg/adapter/containers.go +++ b/pkg/adapter/containers.go @@ -257,7 +257,10 @@ func (r *LocalRuntime) Log(c *cliconfig.LogsValues, options *libpod.LogOptions) func (r *LocalRuntime) CreateContainer(ctx context.Context, c *cliconfig.CreateValues) (string, error) { results := shared.NewIntermediateLayer(&c.PodmanCommand, false) ctr, _, err := shared.CreateContainer(ctx, &results, r.Runtime) - return ctr.ID(), err + if err != nil { + return "", err + } + return ctr.ID(), nil } // Run a libpod container |