Em 30-12-2010 21:11, Jesper Juhl escreveu:
> Hi,
>
> We may leak the storage allocated to 'state' in
> drivers/media/dvb/frontends/ix2505v.c::ix2505v_attach() on error.
> This patch makes sure we free the allocated memory in the failure case.
>
>
> Signed-off-by: Jesper Juhl <[email protected]>
> ---
> ix2505v.c | 1 +
> 1 file changed, 1 insertion(+)
>
> Compile tested only.
>
> diff --git a/drivers/media/dvb/frontends/ix2505v.c
> b/drivers/media/dvb/frontends/ix2505v.c
> index 55f2eba..fcb173d 100644
> --- a/drivers/media/dvb/frontends/ix2505v.c
> +++ b/drivers/media/dvb/frontends/ix2505v.c
> @@ -293,6 +293,7 @@ struct dvb_frontend *ix2505v_attach(struct dvb_frontend
> *fe,
> ret = ix2505v_read_status_reg(state);
>
> if (ret & 0x80) {
> + kfree(state);
Instead of doing the free here, please move it to happen at the error: logic.
Currently, there's just one error condition, but having part of the
release/kfree
logic here and there is not a good idea.
> deb_i2c("%s: No IX2505V found\n", __func__);
> goto error;
> }
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html