Browse Source

ubifs: Fix memory leak in error path in ubifs_mknod

When fscrypt_setup_filename() fails we have to free dev.

Signed-off-by: Richard Weinberger <richard@nod.at>
Richard Weinberger 8 years ago
parent
commit
63ed657362
1 changed files with 3 additions and 1 deletions
  1. 3 1
      fs/ubifs/dir.c

+ 3 - 1
fs/ubifs/dir.c

@@ -1068,8 +1068,10 @@ static int ubifs_mknod(struct inode *dir, struct dentry *dentry,
 	}
 
 	err = fscrypt_setup_filename(dir, &dentry->d_name, 0, &nm);
-	if (err)
+	if (err) {
+		kfree(dev);
 		goto out_budg;
+	}
 
 	sz_change = CALC_DENT_SIZE(fname_len(&nm));