]> git.karo-electronics.de Git - linux-beck.git/commitdiff
V4L/DVB (6784): tda8290: prevent possible memory leak
authorMichael Krufky <mkrufky@linuxtv.org>
Sun, 9 Dec 2007 08:16:10 +0000 (05:16 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Fri, 25 Jan 2008 21:03:27 +0000 (19:03 -0200)
Always call tda829x_release if tda829x_attach fails for a reason
other than failure to allocate memory for private structure.

Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/tda8290.c

index 245b202560b566a896d4c87e2ecb00515fd2a482..a39cb1f9e875d1678288a3327bf1d6e129abc49c 100644 (file)
@@ -704,7 +704,7 @@ int tda829x_attach(struct tuner *t)
        }
 
        if (tda829x_find_tuner(fe) < 0)
-               return -EINVAL;
+               goto fail;
 
        if (priv->ver & TDA8290) {
                tda8290_init_tuner(fe);
@@ -717,6 +717,11 @@ int tda829x_attach(struct tuner *t)
        t->mode = V4L2_TUNER_ANALOG_TV;
 
        return 0;
+
+fail:
+       tda829x_release(fe);
+       fe->ops.analog_demod_ops = NULL;
+       return -EINVAL;
 }
 EXPORT_SYMBOL_GPL(tda829x_attach);