summaryrefslogtreecommitdiff
path: root/sound/drivers/vx
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2006-03-06 13:21:30 +0100
committerJaroslav Kysela <perex@suse.cz>2006-03-22 10:34:50 +0100
commitac57b84984859f3e1d567c031556d3de872c1a91 (patch)
tree28f253e63b2d136db78f9ff115ab5e8d6f1fbbdc /sound/drivers/vx
parent1037593c8be9551d5a7835703bcaf6073ffb7ec2 (diff)
[ALSA] vx - Fix memory leak on error path
Modules: Digigram VX core Noticed by Eric Sesterhenn on kernel-janitors@ Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/drivers/vx')
-rw-r--r--sound/drivers/vx/vx_pcm.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sound/drivers/vx/vx_pcm.c b/sound/drivers/vx/vx_pcm.c
index 2195e25087b4..c4af84995d05 100644
--- a/sound/drivers/vx/vx_pcm.c
+++ b/sound/drivers/vx/vx_pcm.c
@@ -1253,9 +1253,13 @@ static int vx_init_audio_io(struct vx_core *chip)
/* allocate pipes */
chip->playback_pipes = kmalloc(sizeof(struct vx_pipe *) * chip->audio_outs, GFP_KERNEL);
+ if (!chip->playback_pipes)
+ return -ENOMEM;
chip->capture_pipes = kmalloc(sizeof(struct vx_pipe *) * chip->audio_ins, GFP_KERNEL);
- if (! chip->playback_pipes || ! chip->capture_pipes)
+ if (!chip->capture_pipes) {
+ kfree(chip->playback_pipes);
return -ENOMEM;
+ }
memset(chip->playback_pipes, 0, sizeof(struct vx_pipe *) * chip->audio_outs);
memset(chip->capture_pipes, 0, sizeof(struct vx_pipe *) * chip->audio_ins);