lkml.org 
[lkml]   [2006]   [Mar]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] vx: fix memory leak on error path
Noticed by Eric Sesterhenn on kernel-janitors@

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

sound/drivers/vx/vx_pcm.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

--- a/sound/drivers/vx/vx_pcm.c
+++ b/sound/drivers/vx/vx_pcm.c
@@ -1254,9 +1254,13 @@ static int vx_init_audio_io(struct vx_co

/* 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);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-03-04 23:31    [W:0.033 / U:0.444 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site