Signed-off-by: Dwight Engen <dwight.en...@oracle.com>
---
 src/lxc/lxclock.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/lxc/lxclock.c b/src/lxc/lxclock.c
index dea6941..79ebf84 100644
--- a/src/lxc/lxclock.c
+++ b/src/lxc/lxclock.c
@@ -122,6 +122,10 @@ struct lxc_lock *lxc_newlock(const char *lxcpath, const 
char *name)
        if (!name) {
                l->type = LXC_LOCK_ANON_SEM;
                l->u.sem = lxc_new_unnamed_sem();
+               if (!l->u.sem) {
+                       free(l);
+                       l = NULL;
+               }
                goto out;
        }
 
@@ -248,8 +252,11 @@ void lxc_putlock(struct lxc_lock *l)
                return;
        switch(l->type) {
        case LXC_LOCK_ANON_SEM:
-               if (l->u.sem)
+               if (l->u.sem) {
                        sem_close(l->u.sem);
+                       free(l->u.sem);
+                       l->u.sem = NULL;
+               }
                break;
        case LXC_LOCK_FLOCK:
                process_lock();
@@ -264,6 +271,7 @@ void lxc_putlock(struct lxc_lock *l)
                }
                break;
        }
+       free(l);
 }
 
 int process_lock(void)
-- 
1.8.1.4


------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to