Skip to content

Commit

Permalink
Fix refcount leaks
Browse files Browse the repository at this point in the history
Signed-off-by: Alan Jowett <[email protected]>
  • Loading branch information
Alan Jowett committed Nov 28, 2024
1 parent 5f5c451 commit a67e532
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libs/execution_context/ebpf_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1575,6 +1575,8 @@ _ebpf_core_find_matching_link(

if (match_found) {
*link = local_link;
} else if (local_link != NULL) {
EBPF_OBJECT_RELEASE_REFERENCE((ebpf_core_object_t*)local_link);
}

Exit:
Expand Down
5 changes: 5 additions & 0 deletions libs/execution_context/ebpf_program.c
Original file line number Diff line number Diff line change
Expand Up @@ -1030,6 +1030,11 @@ ebpf_program_associate_maps(ebpf_program_t* program, ebpf_map_t** maps, uint32_t
}

ebpf_lock_state_t state = ebpf_lock_lock(&program->lock);
if (program->maps) {
result = EBPF_INVALID_ARGUMENT;
ebpf_lock_unlock(&program->lock, state);
goto Done;
}
// Now go through again and acquire references.
program->maps = program_maps;
program_maps = NULL;
Expand Down

0 comments on commit a67e532

Please sign in to comment.