Hello Alexey

On Wed, 2010-08-11 at 10:06 +0200, ext Alexey Klimov wrote:
> > +
> > +       radio = kzalloc(sizeof(*radio), GFP_KERNEL);
> > +       if (!radio)
> > +               return -ENOMEM;
> > +
> > +       radio->write_buf = kmalloc(256, GFP_KERNEL);
> > +       if (!radio->write_buf)
> > +               return -ENOMEM;
> 
> I'm not sure but it looks like possible memory leak. Shouldn't you
> call to kfree(radio) before returning ENOMEM?

Yes you're right...

> et_drvdata(&radio->videodev, radio);
> > +       platform_set_drvdata(pdev, radio);
> > +
> > +       return 0;
> > +
> > +err_video_register:
> > +       v4l2_device_unregister(&radio->v4l2dev);
> > +err_device_alloc:
> > +       kfree(radio);
> 
> And i'm not sure about this error path.. Before kfree(radio) it's
> needed to call kfree(radio->write_buf), rigth?
> Looks like all erorr paths in this probe function have to be checked.

Yes, I'll the the error handling here...

Thanks,
Matti


--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to