diff options
-rw-r--r-- | drivers/misc/ntsync.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/misc/ntsync.c b/drivers/misc/ntsync.c index 457ff28b789f..b6441e978974 100644 --- a/drivers/misc/ntsync.c +++ b/drivers/misc/ntsync.c @@ -651,13 +651,15 @@ static int ntsync_event_read(struct ntsync_obj *event, void __user *argp) return 0; } -static int ntsync_obj_release(struct inode *inode, struct file *file) +static void ntsync_free_obj(struct ntsync_obj *obj) { - struct ntsync_obj *obj = file->private_data; - fput(obj->dev->file); kfree(obj); +} +static int ntsync_obj_release(struct inode *inode, struct file *file) +{ + ntsync_free_obj(file->private_data); return 0; } @@ -755,7 +757,7 @@ static int ntsync_create_sem(struct ntsync_device *dev, void __user *argp) sem->u.sem.max = args.max; fd = ntsync_obj_get_fd(sem); if (fd < 0) - kfree(sem); + ntsync_free_obj(sem); return fd; } |