> Should it be: > bpf_object__close(obj); > obj = NULL: No, the actual crash is caused by this line: https://github.com/kernel-patches/bpf/blob/bpf-next/tools/testing/selftests/bpf/prog_tests/core_reloc.c#L896 When run_btfgen fails, the obj contains uninitialized data and then bpf_object__close(obj) crashes.