V4L/DVB: cx18-alsa: fix memory leak in error condition
authorDevin Heitmueller <dheitmueller@kernellabs.com>
Sat, 12 Dec 2009 20:38:53 +0000 (17:38 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 26 Feb 2010 18:10:44 +0000 (15:10 -0300)
If the stream is already in use, make sure we free up the memory allocated
earlier.

Thanks to Andy Wall for reviewing and pointing this out.

This work was sponsored by ONELAN Limited.

Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/cx18/cx18-alsa-pcm.c

index 05cb8f1753b59b0392beacbca925d688aa7c071b..e14f8e42a2ab4e06f040da4f04daa7ba3698f905 100644 (file)
@@ -95,6 +95,7 @@ static int snd_cx18_pcm_capture_open(struct snd_pcm_substream *substream)
        /* See if the stream is available */
        if (cx18_claim_stream(item, item->type)) {
                /* No, it's already in use */
+               kfree(item);
                return -EBUSY;
        }