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: cfc4n <cfc4n.cs@gmail.com>
  • Loading branch information
cfc4n authored and ti-mo committed Jan 2, 2024
1 parent 5524bdf commit 99a4e69
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion perf/reader.go
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 99a4e69

Please sign in to comment.