mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ISDN: fix a few resource leaks in sc_ioctl()
@ 2006-03-26 14:16 Jesper Juhl
  2006-03-30  8:51 ` Karsten Keil
  0 siblings, 1 reply; 2+ messages in thread
From: Jesper Juhl @ 2006-03-26 14:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: Karsten Keil, Kai Germaschewski, isdn4linux, Jesper Juhl


Fix a few resource leaks in drivers/isdn/sc/ioctl.c::sc_ioctl()


Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
---

 drivers/isdn/sc/ioctl.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

--- linux-2.6.16-mm1-orig/drivers/isdn/sc/ioctl.c	2006-03-20 06:53:29.000000000 +0100
+++ linux-2.6.16-mm1/drivers/isdn/sc/ioctl.c	2006-03-26 16:11:49.000000000 +0200
@@ -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;
 		}



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-03-30  8:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-26 14:16 [PATCH] ISDN: fix a few resource leaks in sc_ioctl() Jesper Juhl
2006-03-30  8:51 ` Karsten Keil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®