linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vx: fix memory leak on error path
@ 2006-03-04 22:28 Alexey Dobriyan
  0 siblings, 0 replies; only message in thread
From: Alexey Dobriyan @ 2006-03-04 22:28 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Eric Sesterhenn

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);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-03-04 22:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-04 22:28 [PATCH] vx: fix memory leak on error path Alexey Dobriyan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).