lkml.org 
[lkml]   [2006]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] OSS: Fix leak in awe_wave, also remove pointless cast.
Date

Fix resource leak and remove pointless cast of kmalloc return value.


Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
---

sound/oss/awe_wave.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)

--- linux-2.6.16-rc6-orig/sound/oss/awe_wave.c 2006-01-03 04:21:10.000000000 +0100
+++ linux-2.6.16-rc6/sound/oss/awe_wave.c 2006-03-18 23:39:19.000000000 +0100
@@ -2944,7 +2944,7 @@ alloc_new_info(void)
{
awe_voice_list *newlist;

- newlist = (awe_voice_list *)kmalloc(sizeof(*newlist), GFP_KERNEL);
+ newlist = kmalloc(sizeof(*newlist), GFP_KERNEL);
if (newlist == NULL) {
printk(KERN_ERR "AWE32: can't alloc info table\n");
return NULL;
@@ -3547,8 +3547,10 @@ awe_load_guspatch(const char __user *add
smp->checksum_flag = 0;
smp->checksum = 0;

- if ((rc = awe_write_wave_data(addr, sizeof_patch, smprec, -1)) < 0)
+ if ((rc = awe_write_wave_data(addr, sizeof_patch, smprec, -1)) < 0) {
+ kfree(vrec);
return rc;
+ }
sf->mem_ptr += rc;
add_sf_sample(sf, smprec);



-
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/

\
 
 \ /
  Last update: 2006-03-18 23:48    [W:0.118 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site