mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Jesper Juhl <jj@chaosbits.net>
Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	Jaroslav Kysela <perex@perex.cz>
Subject: Re: [PATCH] Don't leak in sound/core/oss/pcm_oss.c::snd_pcm_hw_param_near()
Date: Mon, 10 Jan 2011 11:15:21 +0100	[thread overview]
Message-ID: <s5hbp3pdpza.wl%tiwai@suse.de> (raw)
In-Reply-To: <alpine.LNX.2.00.1101062216190.13988@swampdragon.chaosbits.net>

At Thu, 6 Jan 2011 22:19:47 +0100 (CET),
Jesper Juhl wrote:
> 
> 
> snd_pcm_hw_param_near() will leak the memory allocated to 'save' if the 
> call to snd_pcm_hw_param_max() returns less than zero.
> This patch makes sure we never leak.
> 
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>

Applied now.  Thanks.


Takashi


> ---
>  pcm_oss.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
> index b753ec6..a2e4eb3 100644
> --- a/sound/core/oss/pcm_oss.c
> +++ b/sound/core/oss/pcm_oss.c
> @@ -453,8 +453,10 @@ static int snd_pcm_hw_param_near(struct snd_pcm_substream *pcm,
>  	} else {
>  		*params = *save;
>  		max = snd_pcm_hw_param_max(pcm, params, var, max, &maxdir);
> -		if (max < 0)
> +		if (max < 0) {
> +			kfree(save);
>  			return max;
> +		}
>  		last = 1;
>  	}
>   _end:
> 
> 
> 
> -- 
> Jesper Juhl <jj@chaosbits.net>            http://www.chaosbits.net/
> Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
> Plain text mails only, please.
> 

      reply	other threads:[~2011-01-10 10:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-06 21:19 Jesper Juhl
2011-01-10 10:15 ` Takashi Iwai [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=s5hbp3pdpza.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=jj@chaosbits.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    /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®