Skip to content

Commit

Permalink
ALSA: Don't leak in sound/core/oss/pcm_oss.c::snd_pcm_hw_param_near()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jesper Juhl authored and Takashi Iwai committed Jan 10, 2011
1 parent 689c691 commit 3daa7ea
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sound/core/oss/pcm_oss.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 3daa7ea

Please sign in to comment.