Skip to content

Commit

Permalink
[ALSA] vx - Fix memory leak on error path
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alexey Dobriyan authored and Jaroslav Kysela committed Mar 22, 2006
1 parent 1037593 commit ac57b84
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sound/drivers/vx/vx_pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ac57b84

Please sign in to comment.