aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/oss
diff options
context:
space:
mode:
authorJesper Juhl <jj@chaosbits.net>2011-01-06 16:19:47 -0500
committerTakashi Iwai <tiwai@suse.de>2011-01-10 05:13:42 -0500
commit3daa7ea650d59ae86926f0ced4c4ccd99ab33fda (patch)
tree775ded9a8f63af06d45c79fceac55be3126c36f6 /sound/core/oss
parent689c69120ea3c8db069e11a7065ceffee90d0460 (diff)
ALSA: Don't leak in sound/core/oss/pcm_oss.c::snd_pcm_hw_param_near()
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> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/oss')
-rw-r--r--sound/core/oss/pcm_oss.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index b753ec661fcf..a2e4eb324699 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,
453 } else { 453 } else {
454 *params = *save; 454 *params = *save;
455 max = snd_pcm_hw_param_max(pcm, params, var, max, &maxdir); 455 max = snd_pcm_hw_param_max(pcm, params, var, max, &maxdir);
456 if (max < 0) 456 if (max < 0) {
457 kfree(save);
457 return max; 458 return max;
459 }
458 last = 1; 460 last = 1;
459 } 461 }
460 _end: 462 _end: