Skip to content

Commit 969344f

Browse files
committed
wrap delete key with unsafe.Pointer
1 parent 07096c0 commit 969344f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

processmanager/ebpf/ebpf.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ func populateUSDTSpecMaps(probes []pfelf.USDTProbe, specMap *cebpf.Map, startSpe
177177
specIDs[i] = specID
178178

179179
// Store the spec in the map
180-
if err := specMap.Put(&specID, pfelf.USDTSpecToBytes(spec)); err != nil {
180+
if err := specMap.Put(unsafe.Pointer(&specID), pfelf.USDTSpecToBytes(spec)); err != nil {
181181
return nil, fmt.Errorf("failed to store USDT spec for %s:%s: %w",
182182
probe.Provider, probe.Name, err)
183183
}
@@ -199,7 +199,7 @@ func (lc *linkCloser) Unload() error {
199199
if lc.specMap != nil && len(lc.unloadSpecIDs) > 0 {
200200
for _, specID := range lc.unloadSpecIDs {
201201
if specID != 0 {
202-
if err := lc.specMap.Delete(&specID); err != nil {
202+
if err := lc.specMap.Delete(unsafe.Pointer(&specID)); err != nil {
203203
log.Warnf("Failed to delete spec ID %d from map: %v", specID, err)
204204
errs = append(errs, err)
205205
} else {

0 commit comments

Comments
 (0)