summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulia Kartseva <hex@fb.com>2021-11-23 15:38:11 -0800
committerLennart Poettering <lennart@poettering.net>2021-11-24 09:37:33 +0100
commit7ab3c86d63ce0f046325d1f7b70ed149574cdbcf (patch)
treed1a9a80e1f1e889df417b4ac019439abe68ae980
parente18dadca2426fb1f259153312cce5e4df6554224 (diff)
downloadsystemd-7ab3c86d63ce0f046325d1f7b70ed149574cdbcf.tar.gz
bpf: fix memleak in restrict_fs_bpf
Memory allocated in bpf skeleton is not freed. Wrap ptr in _cleanup_. Fixes: #21471
-rw-r--r--src/core/bpf-lsm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/core/bpf-lsm.c b/src/core/bpf-lsm.c
index ed35cad91d..8af2da0288 100644
--- a/src/core/bpf-lsm.c
+++ b/src/core/bpf-lsm.c
@@ -52,7 +52,7 @@ static bool bpf_can_link_lsm_program(struct bpf_program *prog) {
}
static int prepare_restrict_fs_bpf(struct restrict_fs_bpf **ret_obj) {
- struct restrict_fs_bpf *obj = 0;
+ _cleanup_(restrict_fs_bpf_freep) struct restrict_fs_bpf *obj = NULL;
_cleanup_close_ int inner_map_fd = -1;
int r;