diff options
author | Adrian Bunk <bunk@stusta.de> | 2006-04-10 22:55:19 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-04-11 06:18:51 -0700 |
commit | f4675c7016484220a62069d87958a2873d92f159 (patch) | |
tree | e46542b35921773f947c6efa5bb38b1a885f288c /drivers/isdn/gigaset | |
parent | 8ca445df3a3291c2bdd95b91142c079700a688be (diff) |
[PATCH] isdn/gigaset/common.c: fix a memory leak
Fix a memory leak spotted by the Coverity checker if
(!try_module_get(owner)).
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Acked-by: Tilman Schmidt <tilman@imap.cc>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/isdn/gigaset')
-rw-r--r-- | drivers/isdn/gigaset/common.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c index 68db361e766..749b3da1236 100644 --- a/drivers/isdn/gigaset/common.c +++ b/drivers/isdn/gigaset/common.c @@ -1110,8 +1110,9 @@ struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors, drv = kmalloc(sizeof *drv, GFP_KERNEL); if (!drv) return NULL; + if (!try_module_get(owner)) - return NULL; + goto out1; drv->cs = NULL; drv->have_tty = 0; @@ -1125,10 +1126,11 @@ struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors, drv->cs = kmalloc(minors * sizeof *drv->cs, GFP_KERNEL); if (!drv->cs) - goto out1; + goto out2; + drv->flags = kmalloc(minors * sizeof *drv->flags, GFP_KERNEL); if (!drv->flags) - goto out2; + goto out3; for (i = 0; i < minors; ++i) { drv->flags[i] = 0; @@ -1145,11 +1147,12 @@ struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors, return drv; -out2: +out3: kfree(drv->cs); +out2: + module_put(owner); out1: kfree(drv); - module_put(owner); return NULL; } EXPORT_SYMBOL_GPL(gigaset_initdriver); |