Skip to content

Commit

Permalink
fix endpoint nil pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
Larvan2 committed Apr 3, 2024
1 parent 0223b8b commit 036e5a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion stack_gvisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ func (t *GVisor) Start() error {
}

func (t *GVisor) Close() error {
t.endpoint.Attach(nil)
if t.endpoint != nil {
t.endpoint.Attach(nil)
}
t.stack.Close()
for _, endpoint := range t.stack.CleanupEndpoints() {
endpoint.Abort()
Expand Down
4 changes: 3 additions & 1 deletion stack_mixed.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,9 @@ func (m *Mixed) packetLoop() {
}

func (m *Mixed) Close() error {
m.endpoint.Attach(nil)
if m.endpoint != nil {
m.endpoint.Attach(nil)
}
m.stack.Close()
for _, endpoint := range m.stack.CleanupEndpoints() {
endpoint.Abort()
Expand Down

0 comments on commit 036e5a0

Please sign in to comment.