On Tue, Sep 18, 2018 at 08:34:55AM +0200, Claudio Jeker wrote:
> On Tue, Sep 18, 2018 at 03:49:15PM +1000, Jonathan Gray wrote:
> > Index: amdisplay.c
> > ===================================================================
> > RCS file: /cvs/src/sys/arch/armv7/omap/amdisplay.c,v
> > retrieving revision 1.7
> > diff -u -p -r1.7 amdisplay.c
> > --- amdisplay.c 25 Oct 2017 14:34:22 -0000 1.7
> > +++ amdisplay.c 18 Sep 2018 05:12:41 -0000
> > @@ -272,6 +272,7 @@ amdisplay_attach(struct device *parent,
> >
> > if (rasops_init(&sc->sc_ro, 200, 200)) {
> > printf("%s: no rasops\n", DEVNAME(sc));
> > + free(edid_buf, M_DEVBUF, EDID_LENGTH);
> > amdisplay_detach(self, 0);
> > return;
> > }
> >
>
> I think it is better to free the edid_buf further up in that function
> since it is unused after calling edid_parse(edid_buf, &sc->sc_edid) on
> line 215. So currently there is still a leak at the end of the function.
sounds good to me, ok
>
> --
> :wq Claudio
>
> Index: arch/armv7/omap/amdisplay.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/armv7/omap/amdisplay.c,v
> retrieving revision 1.7
> diff -u -p -r1.7 amdisplay.c
> --- arch/armv7/omap/amdisplay.c 25 Oct 2017 14:34:22 -0000 1.7
> +++ arch/armv7/omap/amdisplay.c 18 Sep 2018 06:32:43 -0000
> @@ -219,6 +219,8 @@ amdisplay_attach(struct device *parent,
> return;
> }
>
> + free(edid_buf, M_DEVBUF, EDID_LENGTH);
> +
> #ifdef LCD_DEBUG
> edid_print(&sc->sc_edid);
> #endif
> @@ -246,7 +248,6 @@ amdisplay_attach(struct device *parent,
> /* configure DMA framebuffer */
> if (amdisplay_setup_dma(sc)) {
> printf("%s: couldn't allocate DMA framebuffer\n", DEVNAME(sc));
> - free(edid_buf, M_DEVBUF, EDID_LENGTH);
> amdisplay_detach(self, 0);
> return;
> }
>