Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Michael Krufky and committed by
Mauro Carvalho Chehab
fa746aee c7919d52

+6 -1
+6 -1
drivers/media/video/tda8290.c
··· 704 704 } 705 705 706 706 if (tda829x_find_tuner(fe) < 0) 707 - return -EINVAL; 707 + goto fail; 708 708 709 709 if (priv->ver & TDA8290) { 710 710 tda8290_init_tuner(fe); ··· 717 717 t->mode = V4L2_TUNER_ANALOG_TV; 718 718 719 719 return 0; 720 + 721 + fail: 722 + tda829x_release(fe); 723 + fe->ops.analog_demod_ops = NULL; 724 + return -EINVAL; 720 725 } 721 726 EXPORT_SYMBOL_GPL(tda829x_attach); 722 727