Skip to content

Commit 3daa7ea

Browse files
jjuhltiwai
authored andcommitted
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>
1 parent 689c691 commit 3daa7ea

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎sound/core/oss/pcm_oss.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,10 @@ static int snd_pcm_hw_param_near(struct snd_pcm_substream *pcm,
453453
} else {
454454
*params = *save;
455455
max = snd_pcm_hw_param_max(pcm, params, var, max, &maxdir);
456-
if (max < 0)
456+
if (max < 0) {
457+
kfree(save);
457458
return max;
459+
}
458460
last = 1;
459461
}
460462
_end:

0 commit comments

Comments
 (0)