Skip to content

Commit 47538a0

Browse files
committed
fix: always close the link before returning
Signed-off-by: Andrea Terzolo <[email protected]>
1 parent ef03418 commit 47538a0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pkg/bpf/detect_linux.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,12 @@ func detectKprobeMulti() bool {
7676
syms := []string{"vprintk"}
7777
opts := link.KprobeMultiOptions{Symbols: syms}
7878

79-
_, err = link.KprobeMulti(prog, opts)
80-
return err == nil
79+
link, err := link.KprobeMulti(prog, opts)
80+
if err != nil {
81+
return false
82+
}
83+
link.Close()
84+
return true
8185
}
8286

8387
func HasKprobeMulti() bool {

0 commit comments

Comments
 (0)