* [PATCH] Don't leak in sound/core/oss/pcm_oss.c::snd_pcm_hw_param_near()
@ 2011-01-06 21:19 Jesper Juhl
2011-01-10 10:15 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Jesper Juhl @ 2011-01-06 21:19 UTC (permalink / raw)
To: alsa-devel; +Cc: linux-kernel, Takashi Iwai, Jaroslav Kysela
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>
---
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Don't leak in sound/core/oss/pcm_oss.c::snd_pcm_hw_param_near()
2011-01-06 21:19 [PATCH] Don't leak in sound/core/oss/pcm_oss.c::snd_pcm_hw_param_near() Jesper Juhl
@ 2011-01-10 10:15 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2011-01-10 10:15 UTC (permalink / raw)
To: Jesper Juhl; +Cc: alsa-devel, linux-kernel, Jaroslav Kysela
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.
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-01-10 10:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-06 21:19 [PATCH] Don't leak in sound/core/oss/pcm_oss.c::snd_pcm_hw_param_near() Jesper Juhl
2011-01-10 10:15 ` Takashi Iwai
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®