mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jesper Juhl <jesper.juhl@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Takashi Iwai <tiwai@suse.de>, Jesper Juhl <jesper.juhl@gmail.com>
Subject: [PATCH] OSS: Fix leak in awe_wave, also remove pointless cast.
Date: Sat, 18 Mar 2006 23:43:11 +0100	[thread overview]
Message-ID: <200603182343.11349.jesper.juhl@gmail.com> (raw)


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);
 




                 reply	other threads:[~2006-03-18 22:43 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=200603182343.11349.jesper.juhl@gmail.com \
    --to=jesper.juhl@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tiwai@suse.de \
    /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

all inboxes | Powered by JetHome®