linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wei Yongjun <weiyj.lk@gmail.com>
To: gregkh@suse.de, willy@parisc-linux.org, kyle@parisc-linux.org
Cc: yongjun_wei@trendmicro.com.cn, linux-kernel@vger.kernel.org
Subject: [PATCH] parport: fix possible memory leak in parport_gsc_probe_port()
Date: Mon, 3 Sep 2012 18:09:53 +0800	[thread overview]
Message-ID: <CAPgLHd-Ma1Ljzsfo1_G7D8AyrXkPfBbY57RfW4Y0hh6k5=f_Dw@mail.gmail.com> (raw)

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

ops has been allocated in this function and should be freed
before leaving from the error handling cases.

spatch with a semantic match is used to found this problem.
(http://coccinelle.lip6.fr/)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/parport/parport_gsc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/parport/parport_gsc.c b/drivers/parport/parport_gsc.c
index 5d6de38..352f961 100644
--- a/drivers/parport/parport_gsc.c
+++ b/drivers/parport/parport_gsc.c
@@ -271,6 +271,7 @@ struct parport *__devinit parport_gsc_probe_port (unsigned long base,
 	if (!parport_SPP_supported (p)) {
 		/* No port. */
 		kfree (priv);
+		kfree(ops);
 		return NULL;
 	}
 	parport_PS2_supported (p);



                 reply	other threads:[~2012-09-03 10:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPgLHd-Ma1Ljzsfo1_G7D8AyrXkPfBbY57RfW4Y0hh6k5=f_Dw@mail.gmail.com' \
    --to=weiyj.lk@gmail.com \
    --cc=gregkh@suse.de \
    --cc=kyle@parisc-linux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=willy@parisc-linux.org \
    --cc=yongjun_wei@trendmicro.com.cn \
    --subject='Re: [PATCH] parport: fix possible memory leak in parport_gsc_probe_port()' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).