[alsa-devel] [PATCH] ALSA: allocation may fail in snd_pcm_oss_change_params()

Roel Kluin roel.kluin at gmail.com
Mon Aug 31 16:23:53 CEST 2009


Allocation may fail, show if it did.

Signed-off-by: Roel Kluin <roel.kluin at gmail.com>
---
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index dbe406b..ea91a0a 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -1047,6 +1047,10 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
 	runtime->oss.prepare = 1;
 	vfree(runtime->oss.buffer);
 	runtime->oss.buffer = vmalloc(runtime->oss.period_bytes);
+	if (runtime->oss.buffer == NULL) {
+		err = -ENOMEM;
+		goto failure;
+	}
 	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));


More information about the Alsa-devel mailing list