Skip to content

Commit

Permalink
Merge pull request #752 from TBBle/fix_crash_in_process_isolated_cont…
Browse files Browse the repository at this point in the history
…ainers

Fix shim crash when cleaning up process-isolated containers
  • Loading branch information
jterry75 authored Jan 7, 2020
2 parents 1364039 + 5a8d86e commit 1f9b057
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/hcsoci/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func ReleaseResources(ctx context.Context, r *Resources, vm *uvm.UtilityVM, all
r.createdNetNS = false
}

if all {
if vm != nil && all {
for len(r.vsmbMounts) != 0 {
mount := r.vsmbMounts[len(r.vsmbMounts)-1]
if err := vm.RemoveVSMB(ctx, mount); err != nil {
Expand Down Expand Up @@ -146,7 +146,7 @@ func ReleaseResources(ctx context.Context, r *Resources, vm *uvm.UtilityVM, all
r.scsiMounts = nil
}

if vm.DeleteContainerStateSupported() {
if vm != nil && vm.DeleteContainerStateSupported() {
if err := vm.DeleteContainerState(ctx, r.id); err != nil {
log.G(ctx).WithError(err).Error("failed to delete container state")
}
Expand Down

0 comments on commit 1f9b057

Please sign in to comment.