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 n;
|
||||
|
||||
pthread_mutex_lock(&access_lock);
|
||||
|
||||
tty_cli = calloc(1, sizeof(ttynvt_cli_t));
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&access_lock);
|
||||
|
||||
if (tty == NULL)
|
||||
tty = _ttynvt_ctx_create();
|
||||
if (!tty)
|
||||
{
|
||||
fuse_reply_err(req, ENOMEM);
|
||||
free(tty_cli);
|
||||
pthread_mutex_unlock(&access_lock);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user