diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2007-12-09 03:16:10 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-01-25 16:03:27 -0500 |
commit | fa746aee336fedfe25e6945e5967399966948420 (patch) | |
tree | 6cf253bc27278ca67ebfd879593dfd9c8970863c | |
parent | c7919d520f4c9a064ae14bc4dd170c4c12ead2af (diff) |
V4L/DVB (6784): tda8290: prevent possible memory leak
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>
-rw-r--r-- | drivers/media/video/tda8290.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c index 245b202560b5..a39cb1f9e875 100644 --- a/drivers/media/video/tda8290.c +++ b/drivers/media/video/tda8290.c | |||
@@ -704,7 +704,7 @@ int tda829x_attach(struct tuner *t) | |||
704 | } | 704 | } |
705 | 705 | ||
706 | if (tda829x_find_tuner(fe) < 0) | 706 | if (tda829x_find_tuner(fe) < 0) |
707 | return -EINVAL; | 707 | goto fail; |
708 | 708 | ||
709 | if (priv->ver & TDA8290) { | 709 | if (priv->ver & TDA8290) { |
710 | tda8290_init_tuner(fe); | 710 | tda8290_init_tuner(fe); |
@@ -717,6 +717,11 @@ int tda829x_attach(struct tuner *t) | |||
717 | t->mode = V4L2_TUNER_ANALOG_TV; | 717 | t->mode = V4L2_TUNER_ANALOG_TV; |
718 | 718 | ||
719 | return 0; | 719 | return 0; |
720 | |||
721 | fail: | ||
722 | tda829x_release(fe); | ||
723 | fe->ops.analog_demod_ops = NULL; | ||
724 | return -EINVAL; | ||
720 | } | 725 | } |
721 | EXPORT_SYMBOL_GPL(tda829x_attach); | 726 | EXPORT_SYMBOL_GPL(tda829x_attach); |
722 | 727 | ||