fix mutex unlock if open fails
This commit is contained in:
+4
-1
@@ -427,7 +427,6 @@ static void ttynvt_open(fuse_req_t req, struct fuse_file_info *info)
|
|||||||
int res;
|
int res;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
pthread_mutex_lock(&access_lock);
|
|
||||||
|
|
||||||
tty_cli = calloc(1, sizeof(ttynvt_cli_t));
|
tty_cli = calloc(1, sizeof(ttynvt_cli_t));
|
||||||
if (!tty_cli)
|
if (!tty_cli)
|
||||||
@@ -435,12 +434,16 @@ static void ttynvt_open(fuse_req_t req, struct fuse_file_info *info)
|
|||||||
fuse_reply_err(req, ENOMEM);
|
fuse_reply_err(req, ENOMEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pthread_mutex_lock(&access_lock);
|
||||||
|
|
||||||
if (tty == NULL)
|
if (tty == NULL)
|
||||||
tty = _ttynvt_ctx_create();
|
tty = _ttynvt_ctx_create();
|
||||||
if (!tty)
|
if (!tty)
|
||||||
{
|
{
|
||||||
fuse_reply_err(req, ENOMEM);
|
fuse_reply_err(req, ENOMEM);
|
||||||
free(tty_cli);
|
free(tty_cli);
|
||||||
|
pthread_mutex_unlock(&access_lock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user