sandbox_run: correct a defer

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
Antonio Murdaca 2017-06-09 13:57:45 +02:00
parent e28540ca90
commit cfec2c4cf4
No known key found for this signature in database
GPG key ID: B2BEAD150DE936B9

View file

@ -317,13 +317,13 @@ func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest
hostname: hostname,
}
s.addSandbox(sb)
defer func() {
if err != nil {
s.removeSandbox(id)
}
}()
s.addSandbox(sb)
if err = s.podIDIndex.Add(id); err != nil {
return nil, err
}