[PATCH] ISDN: fix a few memory leaks in sc_ioctl()
authorJesper Juhl <jesper.juhl@gmail.com>
Fri, 31 Mar 2006 10:30:57 +0000 (02:30 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 31 Mar 2006 20:18:56 +0000 (12:18 -0800)
Fix a few memory leaks in drivers/isdn/sc/ioctl.c::sc_ioctl()

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Acked-by: Karsten Keil <kkeil@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/isdn/sc/ioctl.c

index 94c9afb7017c66791b1eb154bcdf5d53f350b77c..f4f71226a0789ece854f9c717b18a93454c0614a 100644 (file)
@@ -46,7 +46,8 @@ int sc_ioctl(int card, scs_ioctl *data)
                pr_debug("%s: SCIOCRESET: ioctl received\n",
                        sc_adapter[card]->devicename);
                sc_adapter[card]->StartOnReset = 0;
-               return (reset(card));
+               kfree(rcvmsg);
+               return reset(card);
        }
 
        case SCIOCLOAD:
@@ -183,7 +184,7 @@ int sc_ioctl(int card, scs_ioctl *data)
                                sc_adapter[card]->devicename);
 
                spid = kmalloc(SCIOC_SPIDSIZE, GFP_KERNEL);
-               if(!spid) {
+               if (!spid) {
                        kfree(rcvmsg);
                        return -ENOMEM;
                }
@@ -195,10 +196,10 @@ int sc_ioctl(int card, scs_ioctl *data)
                if (!status) {
                        pr_debug("%s: SCIOCGETSPID: command successful\n",
                                        sc_adapter[card]->devicename);
-               }
-               else {
+               } else {
                        pr_debug("%s: SCIOCGETSPID: command failed (status = %d)\n",
                                sc_adapter[card]->devicename, status);
+                       kfree(spid);
                        kfree(rcvmsg);
                        return status;
                }