From: Julia Kartseva Date: Tue, 23 Nov 2021 23:38:11 +0000 (-0800) Subject: bpf: fix memleak in restrict_fs_bpf X-Git-Tag: v250-rc1~174 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7ab3c86d63ce0f046325d1f7b70ed149574cdbcf;p=thirdparty%2Fsystemd.git bpf: fix memleak in restrict_fs_bpf Memory allocated in bpf skeleton is not freed. Wrap ptr in _cleanup_. Fixes: #21471 --- diff --git a/src/core/bpf-lsm.c b/src/core/bpf-lsm.c index ed35cad91dd..8af2da0288d 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;