From 677f111df7259482e4d3f2be3a272e92f441b954 Mon Sep 17 00:00:00 2001 From: Raphael Campos Date: Fri, 26 Jul 2024 15:09:12 -0500 Subject: [PATCH] fix: set 'elf' to nil after closing in BPFLoadObject for GC In the BPFLoadObject function, the 'elf' field is closed, but it is not set to nil. Setting it to nil is necessary for it to be freed by the garbage collector. --- module.go | 1 + 1 file changed, 1 insertion(+) diff --git a/module.go b/module.go index 0f85007..d183aff 100644 --- a/module.go +++ b/module.go @@ -202,6 +202,7 @@ func (m *Module) BPFLoadObject() error { } m.loaded = true m.elf.Close() + m.elf = nil return nil }