linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Francois Romieu <romieu@fr.zoreil.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: linux-kernel@vger.kernel.org, torvalds@osdl.org
Subject: [PATCH] 2.6.0-test1-after-alan-s-patch - Fix error path in kahlua driver
Date: Fri, 18 Jul 2003 21:50:02 +0200	[thread overview]
Message-ID: <20030718215002.A780@electric-eye.fr.zoreil.com> (raw)
In-Reply-To: <200307181431.h6IEVV2g017880@hraefn.swansea.linux.org.uk>; from alan@lxorguk.ukuu.org.uk on Fri, Jul 18, 2003 at 03:31:31PM +0100


Memory leak fix: hw_config is allocated before the call to sb_dsp_detect.

I don't know if it compiles because I haven't done the required patch
for sound/oss/Makefile yet :o)


 sound/oss/kahlua.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff -puN sound/oss/kahlua.c~janitor-error-path-kahlua sound/oss/kahlua.c
--- linux-2.6.0-test1-20030718_0517/sound/oss/kahlua.c~janitor-error-path-kahlua	Fri Jul 18 21:29:52 2003
+++ linux-2.6.0-test1-20030718_0517-fr/sound/oss/kahlua.c	Fri Jul 18 21:38:14 2003
@@ -159,7 +159,7 @@ static int __devinit probe_one(struct pc
 	if(sb_dsp_detect(hw_config, 0, 0, NULL)==0)
 	{
 		printk(KERN_ERR "kahlua: audio not responding.\n");
-		return 1;
+		goto err_out_free;
 	}
 
 	oldquiet = sb_be_quiet;	
@@ -167,13 +167,16 @@ static int __devinit probe_one(struct pc
 	if(sb_dsp_init(hw_config, THIS_MODULE))
 	{
 		sb_be_quiet = oldquiet;
-		pci_set_drvdata(pdev, NULL);
-		kfree(hw_config);
-		return 1;
+		goto err_out_free;
 	}
 	sb_be_quiet = oldquiet;
 	
 	return 0;
+
+err_out_free:
+	pci_set_drvdata(pdev, NULL);
+	kfree(hw_config);
+	return 1;
 }
 
 static void __devexit remove_one(struct pci_dev *pdev)

_

      reply	other threads:[~2003-07-18 19:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-18 14:31 PATCH: Kahlua audio resubmit (fixed this time) Alan Cox
2003-07-18 19:50 ` Francois Romieu [this message]

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=20030718215002.A780@electric-eye.fr.zoreil.com \
    --to=romieu@fr.zoreil.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).