aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Bunk <bunk@stusta.de>2006-03-25 03:07:52 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-25 08:22:57 -0800
commit5c98d29ae4d8cb0e2ce78b82b2c1957bcfd7dbd3 (patch)
tree5078072f74de463766442a01db874b80b0ea1600
parent[PATCH] md/bitmap.c:bitmap_mask_state(): fix inconsequent NULL checking (diff)
downloadlinux-dev-5c98d29ae4d8cb0e2ce78b82b2c1957bcfd7dbd3.tar.xz
linux-dev-5c98d29ae4d8cb0e2ce78b82b2c1957bcfd7dbd3.zip
[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>
-rw-r--r--drivers/char/ipmi/ipmi_msghandler.c12
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,
intf = ipmi_interfaces[if_num];
if ((if_num >= MAX_IPMI_INTERFACES) || IPMI_INVALID_INTERFACE(intf)) {
spin_unlock_irqrestore(&interfaces_lock, flags);
- return -EINVAL;
+ rv = -EINVAL;
+ goto out_kfree;
}
/* Note that each existing user holds a refcount to the interface. */
@@ -751,14 +752,14 @@ int ipmi_create_user(unsigned int if_num,
if (!try_module_get(intf->handlers->owner)) {
rv = -ENODEV;
- goto out_err;
+ goto out_kref;
}
if (intf->handlers->inc_usecount) {
rv = intf->handlers->inc_usecount(intf->send_info);
if (rv) {
module_put(intf->handlers->owner);
- goto out_err;
+ goto out_kref;
}
}
@@ -769,9 +770,10 @@ int ipmi_create_user(unsigned int if_num,
*user = new_user;
return 0;
- out_err:
- kfree(new_user);
+out_kref:
kref_put(&intf->refcount, intf_free);
+out_kfree:
+ kfree(new_user);
return rv;
}