diff --git a/fs/unionfs/fs_unionfs.c b/fs/unionfs/fs_unionfs.c index 23ae2d6a6d..13979a40bb 100644 --- a/fs/unionfs/fs_unionfs.c +++ b/fs/unionfs/fs_unionfs.c @@ -1001,12 +1001,15 @@ static int unionfs_close(FAR struct file *filep) { unionfs_destroy(ui); } + else + { + unionfs_semgive(ui); + } /* Free the open file container */ kmm_free(uf); filep->f_priv = NULL; - unionfs_semgive(ui); return ret; }