The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/3264
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === if (!name), we allocate an unnamed semaphore, but if we then fail to allocate/create the lock, we don't free this semaphore, and we just leak it. Signed-off-by: Tycho Andersen <ty...@tycho.ws>
From b8a6a00cc385fc0c6f36c6497f03a3fd40059706 Mon Sep 17 00:00:00 2001 From: Tycho Andersen <ty...@tycho.ws> Date: Mon, 10 Feb 2020 08:14:33 -0700 Subject: [PATCH] lxclock: fix a small memory leak if (!name), we allocate an unnamed semaphore, but if we then fail to allocate/create the lock, we don't free this semaphore, and we just leak it. Signed-off-by: Tycho Andersen <ty...@tycho.ws> --- src/lxc/lxclock.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lxc/lxclock.c b/src/lxc/lxclock.c index a77951a5b4..318e5bf5a3 100644 --- a/src/lxc/lxclock.c +++ b/src/lxc/lxclock.c @@ -169,6 +169,8 @@ struct lxc_lock *lxc_newlock(const char *lxcpath, const char *name) l->type = LXC_LOCK_FLOCK; l->u.f.fname = lxclock_name(lxcpath, name); if (!l->u.f.fname) { + if (!name) + free(l->u.sem); free(l); l = NULL; goto on_error;
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel