Fix resource leak and remove pointless cast of kmalloc return value.
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
{
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;
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);