From ccff77025c4ef6907c91c42cf84e1c92b65716ba Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Wed, 29 Sep 2021 13:42:23 +0200 Subject: libpod: container create: init variable: do not deep copy spec Do not create an expensive deep copy for the provided spec.Spec when creating a container. No API should be expected to create deep copies of arguments unless explicitly documented. This removes the last call to JSONDeepCopy in a simple `podman run --rm -d busybox true`. [NO TESTS NEEDED] Signed-off-by: Valentin Rothberg --- libpod/runtime_ctr.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'libpod/runtime_ctr.go') diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go index 93bfdd54b..7cda9aa8b 100644 --- a/libpod/runtime_ctr.go +++ b/libpod/runtime_ctr.go @@ -193,10 +193,7 @@ func (r *Runtime) initContainerVariables(rSpec *spec.Spec, config *ContainerConf ctr.config.LogPath = "" } - ctr.config.Spec = new(spec.Spec) - if err := JSONDeepCopy(rSpec, ctr.config.Spec); err != nil { - return nil, errors.Wrapf(err, "error copying runtime spec while creating container") - } + ctr.config.Spec = rSpec ctr.config.CreatedTime = time.Now() ctr.state.BindMounts = make(map[string]string) -- cgit v1.2.3-54-g00ecf