]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxclock: cleanup lxc_putlock()
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 9 Dec 2020 10:32:55 +0000 (11:32 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 10 Dec 2020 19:39:54 +0000 (20:39 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/lxclock.c

index a08f569858e9ce9187f4313e667c244a0f0ccf42..650a083d60461ce00efe86dc5b0c258f49de4b24 100644 (file)
@@ -264,24 +264,16 @@ void lxc_putlock(struct lxc_lock *l)
        if (!l)
                return;
 
-       switch(l->type) {
+       switch (l->type) {
        case LXC_LOCK_ANON_SEM:
                if (l->u.sem) {
                        sem_destroy(l->u.sem);
-                       free(l->u.sem);
-                       l->u.sem = NULL;
+                       free_disarm(l->u.sem);
                }
-
                break;
        case LXC_LOCK_FLOCK:
-               if (l->u.f.fd >= 0) {
-                       close(l->u.f.fd);
-                       l->u.f.fd = -1;
-               }
-
-               free(l->u.f.fname);
-               l->u.f.fname = NULL;
-
+               close_prot_errno_disarm(l->u.f.fd);
+               free_disarm(l->u.f.fname);
                break;
        }