diff options
author | Adrian Bunk <bunk@stusta.de> | 2006-03-25 06:07:52 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-25 11:22:57 -0500 |
commit | 5c98d29ae4d8cb0e2ce78b82b2c1957bcfd7dbd3 (patch) | |
tree | 5078072f74de463766442a01db874b80b0ea1600 /drivers/char/ipmi/ipmi_msghandler.c | |
parent | 7e3176555003a45318010d9820eb5ad1abb596bf (diff) |
[PATCH] drivers/char/ipmi/ipmi_msghandler.c: fix a memory leak
The Coverity checker found this memory leak.
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Acked-by: Corey Minyard <minyard@acm.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/ipmi/ipmi_msghandler.c')
-rw-r--r-- | drivers/char/ipmi/ipmi_msghandler.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index d745004281d0..abd4c5118a1b 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
@@ -736,7 +736,8 @@ int ipmi_create_user(unsigned int if_num, | |||
736 | intf = ipmi_interfaces[if_num]; | 736 | intf = ipmi_interfaces[if_num]; |
737 | if ((if_num >= MAX_IPMI_INTERFACES) || IPMI_INVALID_INTERFACE(intf)) { | 737 | if ((if_num >= MAX_IPMI_INTERFACES) || IPMI_INVALID_INTERFACE(intf)) { |
738 | spin_unlock_irqrestore(&interfaces_lock, flags); | 738 | spin_unlock_irqrestore(&interfaces_lock, flags); |
739 | return -EINVAL; | 739 | rv = -EINVAL; |
740 | goto out_kfree; | ||
740 | } | 741 | } |
741 | 742 | ||
742 | /* Note that each existing user holds a refcount to the interface. */ | 743 | /* Note that each existing user holds a refcount to the interface. */ |
@@ -751,14 +752,14 @@ int ipmi_create_user(unsigned int if_num, | |||
751 | 752 | ||
752 | if (!try_module_get(intf->handlers->owner)) { | 753 | if (!try_module_get(intf->handlers->owner)) { |
753 | rv = -ENODEV; | 754 | rv = -ENODEV; |
754 | goto out_err; | 755 | goto out_kref; |
755 | } | 756 | } |
756 | 757 | ||
757 | if (intf->handlers->inc_usecount) { | 758 | if (intf->handlers->inc_usecount) { |
758 | rv = intf->handlers->inc_usecount(intf->send_info); | 759 | rv = intf->handlers->inc_usecount(intf->send_info); |
759 | if (rv) { | 760 | if (rv) { |
760 | module_put(intf->handlers->owner); | 761 | module_put(intf->handlers->owner); |
761 | goto out_err; | 762 | goto out_kref; |
762 | } | 763 | } |
763 | } | 764 | } |
764 | 765 | ||
@@ -769,9 +770,10 @@ int ipmi_create_user(unsigned int if_num, | |||
769 | *user = new_user; | 770 | *user = new_user; |
770 | return 0; | 771 | return 0; |
771 | 772 | ||
772 | out_err: | 773 | out_kref: |
773 | kfree(new_user); | ||
774 | kref_put(&intf->refcount, intf_free); | 774 | kref_put(&intf->refcount, intf_free); |
775 | out_kfree: | ||
776 | kfree(new_user); | ||
775 | return rv; | 777 | return rv; |
776 | } | 778 | } |
777 | 779 | ||