Skip to content

Commit

Permalink
link: fix nil pointer dereference
Browse files Browse the repository at this point in the history
Signed-off-by: Gavin Bunney <[email protected]>
  • Loading branch information
gavinbunney committed Jul 10, 2024
1 parent 5976561 commit b83c276
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion link/xdp.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ func AttachXDP(opts XDPOptions) (Link, error) {
Flags: uint32(opts.Flags),
})

return &xdpLink{*rawLink}, err
if err != nil {
return nil, fmt.Errorf("failed to attach link: %w", err)
}

return &xdpLink{*rawLink}, nil
}

type xdpLink struct {
Expand Down

0 comments on commit b83c276

Please sign in to comment.