Commit 684bdc7ff95e0c1d4b0bcf236491840b55a54189

Authored by Jan Blunck
Committed by Al Viro
1 parent 404e781249

JFS: Free sbi memory in error path

I spotted the missing kfree() while removing the BKL.

[akpm@linux-foundation.org: avoid multiple returns so it doesn't happen again]
Signed-off-by: Jan Blunck <jblunck@suse.de>
Cc: Dave Kleikamp <shaggy@austin.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Showing 1 changed file with 6 additions and 7 deletions Side-by-side Diff

... ... @@ -446,10 +446,8 @@
446 446 /* initialize the mount flag and determine the default error handler */
447 447 flag = JFS_ERR_REMOUNT_RO;
448 448  
449   - if (!parse_options((char *) data, sb, &newLVSize, &flag)) {
450   - kfree(sbi);
451   - return -EINVAL;
452   - }
  449 + if (!parse_options((char *) data, sb, &newLVSize, &flag))
  450 + goto out_kfree;
453 451 sbi->flag = flag;
454 452  
455 453 #ifdef CONFIG_JFS_POSIX_ACL
... ... @@ -458,7 +456,7 @@
458 456  
459 457 if (newLVSize) {
460 458 printk(KERN_ERR "resize option for remount only\n");
461   - return -EINVAL;
  459 + goto out_kfree;
462 460 }
463 461  
464 462 /*
... ... @@ -478,7 +476,7 @@
478 476 inode = new_inode(sb);
479 477 if (inode == NULL) {
480 478 ret = -ENOMEM;
481   - goto out_kfree;
  479 + goto out_unload;
482 480 }
483 481 inode->i_ino = 0;
484 482 inode->i_nlink = 1;
485 483  
... ... @@ -550,9 +548,10 @@
550 548 make_bad_inode(sbi->direct_inode);
551 549 iput(sbi->direct_inode);
552 550 sbi->direct_inode = NULL;
553   -out_kfree:
  551 +out_unload:
554 552 if (sbi->nls_tab)
555 553 unload_nls(sbi->nls_tab);
  554 +out_kfree:
556 555 kfree(sbi);
557 556 return ret;
558 557 }