From a7ef153433cc0fe33119883a106b4e87507380d3 Mon Sep 17 00:00:00 2001 From: Kevin Parsons Date: Tue, 1 Feb 2022 14:31:45 -0800 Subject: [PATCH] shim: Don't shadow err return in createPod Correctly uses a named return value on createPod. Previously if err was redeclared in a nested scope and then returned, defers would not see the returned error value. In particular this prevented the UVM cleanup defer from working properly. Signed-off-by: Kevin Parsons --- cmd/containerd-shim-runhcs-v1/pod.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/containerd-shim-runhcs-v1/pod.go b/cmd/containerd-shim-runhcs-v1/pod.go index a4713f2892..c1d393ad2a 100644 --- a/cmd/containerd-shim-runhcs-v1/pod.go +++ b/cmd/containerd-shim-runhcs-v1/pod.go @@ -53,7 +53,7 @@ type shimPod interface { KillTask(ctx context.Context, tid, eid string, signal uint32, all bool) error } -func createPod(ctx context.Context, events publisher, req *task.CreateTaskRequest, s *specs.Spec) (shimPod, error) { +func createPod(ctx context.Context, events publisher, req *task.CreateTaskRequest, s *specs.Spec) (_ shimPod, err error) { log.G(ctx).WithField("tid", req.ID).Debug("createPod") if osversion.Build() < osversion.RS5 {