Repository navigation
Commit fbcde19
gfs2: Fix error path kobject memory leak
If a call to kobject_init_and_add() fails we must call kobject_put()
otherwise we leak memory.
Function gfs2_sys_fs_add always calls kobject_init_and_add() which
always calls kobject_init().
It is safe to leave object destruction up to the kobject release
function and never free it manually.
Remove call to kfree() and always call kobject_put() in the error path.
Signed-off-by: Tobin C. Harding <tobin@kernel.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>1 parent 3aff5fa commit fbcde19
1 file changed
Lines changed: 1 addition & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
650 | 650 | | |
651 | 651 | | |
652 | 652 | | |
653 | | - | |
654 | 653 | | |
655 | 654 | | |
656 | 655 | | |
| |||
661 | 660 | | |
662 | 661 | | |
663 | 662 | | |
664 | | - | |
665 | | - | |
666 | 663 | | |
667 | 664 | | |
668 | 665 | | |
| |||
687 | 684 | | |
688 | 685 | | |
689 | 686 | | |
690 | | - | |
691 | | - | |
692 | | - | |
693 | | - | |
| 687 | + | |
694 | 688 | | |
695 | 689 | | |
696 | 690 | | |
| |||
0 commit comments