Commit ac57b84984859f3e1d567c031556d3de872c1a91
Committed by
Jaroslav Kysela
1 parent
1037593c8b
Exists in
master
and in
20 other branches
[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>
Showing 1 changed file with 5 additions and 1 deletions Side-by-side Diff
sound/drivers/vx/vx_pcm.c
... | ... | @@ -1253,9 +1253,13 @@ |
1253 | 1253 | |
1254 | 1254 | /* allocate pipes */ |
1255 | 1255 | chip->playback_pipes = kmalloc(sizeof(struct vx_pipe *) * chip->audio_outs, GFP_KERNEL); |
1256 | + if (!chip->playback_pipes) | |
1257 | + return -ENOMEM; | |
1256 | 1258 | chip->capture_pipes = kmalloc(sizeof(struct vx_pipe *) * chip->audio_ins, GFP_KERNEL); |
1257 | - if (! chip->playback_pipes || ! chip->capture_pipes) | |
1259 | + if (!chip->capture_pipes) { | |
1260 | + kfree(chip->playback_pipes); | |
1258 | 1261 | return -ENOMEM; |
1262 | + } | |
1259 | 1263 | |
1260 | 1264 | memset(chip->playback_pipes, 0, sizeof(struct vx_pipe *) * chip->audio_outs); |
1261 | 1265 | memset(chip->capture_pipes, 0, sizeof(struct vx_pipe *) * chip->audio_ins); |