Skip to content

Commit

Permalink
chore(engine/bpf): close only used fds
Browse files Browse the repository at this point in the history
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
  • Loading branch information
therealbobo authored and LucaGuerra committed Aug 1, 2024
1 parent b8ea9b2 commit cf1dec3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions userspace/libscap/engine/bpf/scap_bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1386,8 +1386,11 @@ int32_t scap_bpf_close(struct scap_engine_handle engine)

for(int i = 0; i < BPF_MAPS_MAX; i++)
{
close(handle->m_bpf_map_fds[i]);
handle->m_bpf_map_fds[i] = -1;
if(handle->m_bpf_map_fds[i] >= 0)
{
close(handle->m_bpf_map_fds[i]);
handle->m_bpf_map_fds[i] = -1;
}
}

return SCAP_SUCCESS;
Expand Down

0 comments on commit cf1dec3

Please sign in to comment.