Skip to content

Commit

Permalink
lxclock: cleanup lxc_putlock()
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Dec 10, 2020
1 parent 129c915 commit e442322
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/lxc/lxclock.c
Expand Up @@ -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;
}

Expand Down

0 comments on commit e442322

Please sign in to comment.