public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8712: rtl871x_ioctl_linux.c:  Cleaning up memory leak
@ 2014-06-01 11:30 Rickard Strandqvist
  2014-06-01 22:28 ` Christian Engelmayer
  2014-06-02  8:41 ` Dan Carpenter
  0 siblings, 2 replies; 4+ messages in thread
From: Rickard Strandqvist @ 2014-06-01 11:30 UTC (permalink / raw)
  To: Larry Finger, Florian Schilhabel
  Cc: Rickard Strandqvist, Greg Kroah-Hartman, Paul Gortmaker,
	Thomas Cort, Andy Shevchenko, devel, linux-kernel

There is a risk for memory leak in when something unexpected happens
and the function returns.

This was largely found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
index 23d539d..27e0243 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
@@ -1822,6 +1822,7 @@ static int r871x_wx_set_enc_ext(struct net_device *dev,
 		alg_name = "CCMP";
 		break;
 	default:
+		kfree(param);
 		return -EINVAL;
 	}
 	strncpy((char *)param->u.crypt.alg, alg_name, IEEE_CRYPT_ALG_NAME_LEN);
-- 
1.7.10.4


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

end of thread, other threads:[~2014-06-02 22:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-01 11:30 [PATCH] staging: rtl8712: rtl871x_ioctl_linux.c: Cleaning up memory leak Rickard Strandqvist
2014-06-01 22:28 ` Christian Engelmayer
2014-06-02  8:41 ` Dan Carpenter
2014-06-02 22:09   ` Rickard Strandqvist

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