[PATCH] 2.6.0-test1-after-alan-s-patch - Fix error path in kahlua driver

From: Francois Romieu (romieu@fr.zoreil.com)
Date: Fri Jul 18 2003 - 14:50:02 EST


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)

_
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Jul 23 2003 - 22:00:35 EST