From: Christian Brauner Date: Thu, 28 Jan 2021 18:19:32 +0000 (+0100) Subject: lsm: s/lsm_init/lsm_init_static/g X-Git-Tag: lxc-5.0.0~313^2~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4eb19ac075ff1fae75ce66bc440b19b0697740e5;p=thirdparty%2Flxc.git lsm: s/lsm_init/lsm_init_static/g Make it clear that there is nothing to free here. Signed-off-by: Christian Brauner --- diff --git a/src/lxc/attach.c b/src/lxc/attach.c index 41af56850..3b31a39ed 100644 --- a/src/lxc/attach.c +++ b/src/lxc/attach.c @@ -120,7 +120,7 @@ static int get_attach_context(struct attach_context *ctx, if (!found) return log_error_errno(-ENOENT, ENOENT, "Failed to read capability bounding set from %s", proc_fn); - ctx->lsm_ops = lsm_init(); + ctx->lsm_ops = lsm_init_static(); ctx->lsm_label = ctx->lsm_ops->process_label_get(ctx->lsm_ops, ctx->init_pid); ctx->ns_inherited = 0; diff --git a/src/lxc/lsm/lsm.c b/src/lxc/lsm/lsm.c index 7fe34bfb0..f6692e4ee 100644 --- a/src/lxc/lsm/lsm.c +++ b/src/lxc/lsm/lsm.c @@ -21,7 +21,7 @@ __hidden extern struct lsm_ops *lsm_apparmor_ops_init(void); __hidden extern struct lsm_ops *lsm_selinux_ops_init(void); __hidden extern struct lsm_ops *lsm_nop_ops_init(void); -struct lsm_ops *lsm_init(void) +struct lsm_ops *lsm_init_static(void) { struct lsm_ops *ops = NULL; diff --git a/src/lxc/lsm/lsm.h b/src/lxc/lsm/lsm.h index 52d436425..ddbc5949b 100644 --- a/src/lxc/lsm/lsm.h +++ b/src/lxc/lsm/lsm.h @@ -33,6 +33,6 @@ struct lsm_ops { int (*process_label_set_at)(struct lsm_ops *ops, int label_fd, const char *label, bool on_exec); }; -__hidden extern struct lsm_ops *lsm_init(void); +__hidden extern struct lsm_ops *lsm_init_static(void); #endif /* __LXC_LSM_H */ diff --git a/src/lxc/start.c b/src/lxc/start.c index 863ae123b..9370465c9 100644 --- a/src/lxc/start.c +++ b/src/lxc/start.c @@ -728,7 +728,7 @@ int lxc_init(const char *name, struct lxc_handler *handler) if (status_fd < 0) return log_error_errno(-1, errno, "Failed to open monitor status fd"); - handler->lsm_ops = lsm_init(); + handler->lsm_ops = lsm_init_static(); TRACE("Initialized LSM"); /* Begin by setting the state to STARTING. */ diff --git a/src/tests/attach.c b/src/tests/attach.c index 879017fd8..fbc75fa00 100644 --- a/src/tests/attach.c +++ b/src/tests/attach.c @@ -400,7 +400,7 @@ int main(int argc, char *argv[]) (void)strlcpy(template, P_tmpdir"/attach_XXXXXX", sizeof(template)); - lsm_ops = lsm_init(); + lsm_ops = lsm_init_static(); i = lxc_make_tmpfile(template, false); if (i < 0) {