Skip to content

Commit 7ab3c86

Browse files
Julia Kartsevapoettering
authored andcommitted
bpf: fix memleak in restrict_fs_bpf
Memory allocated in bpf skeleton is not freed. Wrap ptr in _cleanup_. Fixes: systemd#21471
1 parent e18dadc commit 7ab3c86

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/core/bpf-lsm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ static bool bpf_can_link_lsm_program(struct bpf_program *prog) {
5252
}
5353

5454
static int prepare_restrict_fs_bpf(struct restrict_fs_bpf **ret_obj) {
55-
struct restrict_fs_bpf *obj = 0;
55+
_cleanup_(restrict_fs_bpf_freep) struct restrict_fs_bpf *obj = NULL;
5656
_cleanup_close_ int inner_map_fd = -1;
5757
int r;
5858

0 commit comments

Comments
 (0)