diff --git a/process/process_bsd.go b/process/process_bsd.go index 263829ffa..4355455ac 100644 --- a/process/process_bsd.go +++ b/process/process_bsd.go @@ -71,6 +71,6 @@ func (p *Process) EnvironWithContext(ctx context.Context) ([]string, error) { func parseKinfoProc(buf []byte) (KinfoProc, error) { var k KinfoProc br := bytes.NewReader(buf) - err := common.Read(br, binary.LittleEndian, &k) + err := binary.Read(br, binary.LittleEndian, &k) return k, err } diff --git a/process/process_freebsd.go b/process/process_freebsd.go index 40b10e14f..695cabbe0 100644 --- a/process/process_freebsd.go +++ b/process/process_freebsd.go @@ -6,6 +6,7 @@ package process import ( "bytes" "context" + "fmt" "path/filepath" "strconv" "strings" @@ -338,5 +339,9 @@ func (p *Process) getKProc() (*KinfoProc, error) { if err != nil { return nil, err } + if &k == nil { + return nil, fmt.Errorf("kInfoProc is nil") + } + return &k, nil }