mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-30 23:06:27 +00:00
Merge pull request #1427 from Ace-Tang/fix-qemu-leak
qemu: fix qemu leak when failed to start container
This commit is contained in:
commit
c9a3b933f8
@ -108,7 +108,7 @@ func createSandboxFromConfig(ctx context.Context, sandboxConfig SandboxConfig, f
|
||||
}
|
||||
}()
|
||||
|
||||
if err := s.getAndStoreGuestDetails(); err != nil {
|
||||
if err = s.getAndStoreGuestDetails(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
@ -913,7 +913,7 @@ func (s *Sandbox) ListRoutes() ([]*vcTypes.Route, error) {
|
||||
}
|
||||
|
||||
// startVM starts the VM.
|
||||
func (s *Sandbox) startVM() error {
|
||||
func (s *Sandbox) startVM() (err error) {
|
||||
span, ctx := s.trace("startVM")
|
||||
defer span.Finish()
|
||||
|
||||
@ -944,6 +944,12 @@ func (s *Sandbox) startVM() error {
|
||||
return err
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if err != nil {
|
||||
s.hypervisor.stopSandbox()
|
||||
}
|
||||
}()
|
||||
|
||||
// In case of vm factory, network interfaces are hotplugged
|
||||
// after vm is started.
|
||||
if s.factory != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user