diff options
Diffstat (limited to 'pkg/sentry/loader/elf.go')
-rw-r--r-- | pkg/sentry/loader/elf.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/pkg/sentry/loader/elf.go b/pkg/sentry/loader/elf.go index 8579eeee4..d2f18cd4f 100644 --- a/pkg/sentry/loader/elf.go +++ b/pkg/sentry/loader/elf.go @@ -271,6 +271,11 @@ func mapSegment(ctx context.Context, m *mm.MemoryManager, f *fs.File, phdr *elf. Perms: prot, MaxPerms: usermem.AnyAccess, } + defer func() { + if mopts.MappingIdentity != nil { + mopts.MappingIdentity.DecRef() + } + }() if err := f.ConfigureMMap(ctx, &mopts); err != nil { ctx.Infof("File is not memory-mappable: %v", err) return err |