summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorRoel Kluin <roel.kluin@gmail.com>2009-08-31 16:32:12 +0200
committerTakashi Iwai <tiwai@suse.de>2009-08-31 16:33:23 +0200
commitcbbb05703da4b205bb17fde555d3b2926d8b3194 (patch)
tree624bf0586117f66cd1301a8c1027ac76764c46ff /sound
parentf1d269bac24e5ddb3a0650aaeb4117aa806b99f1 (diff)
ALSA: allocation may fail in snd_pcm_oss_change_params()
Allocation may fail, show if it did. Signed-off-by: Roel Kluin <roel.kluin@gmail.com> [Additional fix for invalid runtime->oss.prepare flag set by tiwai] Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/core/oss/pcm_oss.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index dbe406b8259..d35d61b3292 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -1043,10 +1043,15 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
runtime->oss.channels = params_channels(params);
runtime->oss.rate = params_rate(params);
- runtime->oss.params = 0;
- runtime->oss.prepare = 1;
vfree(runtime->oss.buffer);
runtime->oss.buffer = vmalloc(runtime->oss.period_bytes);
+ if (!runtime->oss.buffer) {
+ err = -ENOMEM;
+ goto failure;
+ }
+
+ runtime->oss.params = 0;
+ runtime->oss.prepare = 1;
runtime->oss.buffer_used = 0;
if (runtime->dma_area)
snd_pcm_format_set_silence(runtime->format, runtime->dma_area, bytes_to_samples(runtime, runtime->dma_bytes));