lkml.org 
[lkml]   [2006]   [May]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH][resend] fix resource leak in pnp card_probe()
Keith Owens <kaos@ocs.com.au> wrote:
>
> >+ clink = pnp_alloc(sizeof(*clink));
> >+ if (!clink)
> >+ return 0;
> >+ clink->card = card;
> >+ clink->driver = drv;
> >+ clink->pm_state = PMSG_ON;
>
> Memory leak of clink on next test.
>
> >+
> >+ if (drv->probe(clink, id) >= 0)
> >+ return 1;
> >+
> >+ /* Recovery */
> >+ card_for_each_dev(card, dev) {
> >+ if (dev->card_link == clink)
> >+ pnp_release_card_device(dev);
> > }
> >+ kfree(clink);
> > return 0;
> > }

No, if ->probe succeeded, it took over control of the memory at *clink.

It's all rather twisty and quite undocumented.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-05-14 12:04    [W:0.044 / U:0.388 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site