From: Jesper Juhl Date: Fri, 23 Jun 2006 09:05:27 +0000 (-0700) Subject: [PATCH] i4l: memory leak fix for sc_ioctl(). X-Git-Tag: v2.6.18-rc1~1081^2~59 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94a6735cd67375029c2092e6d46f14b2721e6793;p=linux-2.6 [PATCH] i4l: memory leak fix for sc_ioctl(). Fix leak of `rcvmsg' in sc_ioctl(). There are two returns in the switch in sc_ioctl (the SCIOCSTART case) that may leak `rcvmsg'. This patch fixes that by adding a kfree() call at the beginning of that case. Bug found by the coverity checker as #1098 Eric Sesterhenn send me a patch to fix the leak(s) by adding 2 kfree() calls before the returns, I changed that into just a single call at the beginning. Signed-off-by: Jesper Juhl Cc: Karsten Keil Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/isdn/sc/ioctl.c b/drivers/isdn/sc/ioctl.c index f4f71226a0..57c4ab96d1 100644 --- a/drivers/isdn/sc/ioctl.c +++ b/drivers/isdn/sc/ioctl.c @@ -97,6 +97,7 @@ int sc_ioctl(int card, scs_ioctl *data) case SCIOCSTART: { + kfree(rcvmsg); pr_debug("%s: SCIOSTART: ioctl received\n", sc_adapter[card]->devicename); if(sc_adapter[card]->EngineUp) {