[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>
This commit is contained in:
committed by
Jaroslav Kysela
parent
1037593c8b
commit
ac57b84984
@@ -1253,9 +1253,13 @@ static int vx_init_audio_io(struct vx_core *chip)
|
|||||||
|
|
||||||
/* allocate pipes */
|
/* allocate pipes */
|
||||||
chip->playback_pipes = kmalloc(sizeof(struct vx_pipe *) * chip->audio_outs, GFP_KERNEL);
|
chip->playback_pipes = kmalloc(sizeof(struct vx_pipe *) * chip->audio_outs, GFP_KERNEL);
|
||||||
chip->capture_pipes = kmalloc(sizeof(struct vx_pipe *) * chip->audio_ins, GFP_KERNEL);
|
if (!chip->playback_pipes)
|
||||||
if (! chip->playback_pipes || ! chip->capture_pipes)
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
chip->capture_pipes = kmalloc(sizeof(struct vx_pipe *) * chip->audio_ins, GFP_KERNEL);
|
||||||
|
if (!chip->capture_pipes) {
|
||||||
|
kfree(chip->playback_pipes);
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
memset(chip->playback_pipes, 0, sizeof(struct vx_pipe *) * chip->audio_outs);
|
memset(chip->playback_pipes, 0, sizeof(struct vx_pipe *) * chip->audio_outs);
|
||||||
memset(chip->capture_pipes, 0, sizeof(struct vx_pipe *) * chip->audio_ins);
|
memset(chip->capture_pipes, 0, sizeof(struct vx_pipe *) * chip->audio_ins);
|
||||||
|
Reference in New Issue
Block a user