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 <[email protected]>
  • Loading branch information
therealbobo authored and poiana committed Jul 16, 2024
1 parent 12f50b4 commit 60317a6
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 60317a6

Please sign in to comment.