Unverified Commit 8ecd7f2f by Tycho Andersen Committed by Christian Brauner

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: 's avatarTycho Andersen <tycho@tycho.ws>
parent a4922b61
...@@ -169,6 +169,8 @@ struct lxc_lock *lxc_newlock(const char *lxcpath, const char *name) ...@@ -169,6 +169,8 @@ struct lxc_lock *lxc_newlock(const char *lxcpath, const char *name)
l->type = LXC_LOCK_FLOCK; l->type = LXC_LOCK_FLOCK;
l->u.f.fname = lxclock_name(lxcpath, name); l->u.f.fname = lxclock_name(lxcpath, name);
if (!l->u.f.fname) { if (!l->u.f.fname) {
if (!name)
free(l->u.sem);
free(l); free(l);
l = NULL; l = NULL;
goto on_error; goto on_error;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment