Skip to content

Commit

Permalink
perf: fix nil pointer when perf map create failed
Browse files Browse the repository at this point in the history
Signed-off-by: Author Name <cfc4ncs@gmail.com>
  • Loading branch information
cfc4n committed Dec 22, 2023
1 parent 5ab7746 commit 6061d12
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion perf/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,12 @@ func NewReaderWithOptions(array *ebpf.Map, perCPUBuffer int, opts ReaderOptions)
pauseFds = append(pauseFds, -1)
continue
}
bufferSize = ring.size()

if err != nil {
return nil, fmt.Errorf("failed to create perf ring for CPU %d: %v", i, err)
}

bufferSize = ring.size()
rings = append(rings, ring)
pauseFds = append(pauseFds, ring.fd)

Expand Down

0 comments on commit 6061d12

Please sign in to comment.