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 poiana committed Aug 1, 2024
1 parent 83a9165 commit c0c6639
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 c0c6639

Please sign in to comment.