[igt-dev] [PATCH i-g-t] chamelium: Fix analog bridge detection memory leak

Paul Kocialkowski paul.kocialkowski at bootlin.com
Fri Nov 30 14:02:52 UTC 2018


Hi,

On Tue, 2018-11-20 at 20:44 -0500, Lyude Paul wrote:
> Reviewed-by: Lyude Paul <lyude at redhat.com>
> 
> Do you need me to push this? Or do you have push access for igt nowadays?

Sorry for the delayed answer. I don't have commit access, so feel free
to push this!

Thanks,

Paul

> On Wed, 2018-11-14 at 16:29 +0100, Paul Kocialkowski wrote:
> > The connector and EDID blob retrieved when checking for analog bridges
> > need to be freed before returning from the associated function.
> > 
> > Fixes: f8d6afa67 ("tests/chamelium: Detect analog bridges and handle
> > EDID accordingly")
> > Signed-off-by: Paul Kocialkowski <paul.kocialkowski at bootlin.com>
> > ---
> >  tests/kms_chamelium.c | 10 ++++++----
> >  1 file changed, 6 insertions(+), 4 deletions(-)
> > 
> > diff --git a/tests/kms_chamelium.c b/tests/kms_chamelium.c
> > index e0e3e3f1..55b346a9 100644
> > --- a/tests/kms_chamelium.c
> > +++ b/tests/kms_chamelium.c
> > @@ -175,8 +175,10 @@ check_analog_bridge(data_t *data, struct chamelium_port
> > *port)
> >  	unsigned char *edid;
> >  	char edid_vendor[3];
> >  
> > -	if (chamelium_port_get_type(port) != DRM_MODE_CONNECTOR_VGA)
> > +	if (chamelium_port_get_type(port) != DRM_MODE_CONNECTOR_VGA) {
> > +		drmModeFreeConnector(connector);
> >  		return false;
> > +	}
> >  
> >  	igt_assert(kmstest_get_property(data->drm_fd, connector->connector_id,
> >  					DRM_MODE_OBJECT_CONNECTOR, "EDID",
> > NULL,
> > @@ -191,14 +193,14 @@ check_analog_bridge(data_t *data, struct
> > chamelium_port *port)
> >  			  ((edid[9] & 0xe0) >> 5)) + '@';
> >  	edid_vendor[2] = (edid[9] & 0x1f) + '@';
> >  
> > +	drmModeFreePropertyBlob(edid_blob);
> > +	drmModeFreeConnector(connector);
> > +
> >  	/* Analog bridges provide their own EDID */
> >  	if (edid_vendor[0] != 'I' || edid_vendor[1] != 'G' ||
> >  	    edid_vendor[0] != 'T')
> >  		return true;
> >  
> > -	drmModeFreePropertyBlob(edid_blob);
> > -	drmModeFreeConnector(connector);
> > -
> >  	return false;
> >  }
> >  
-- 
Paul Kocialkowski, Bootlin (formerly Free Electrons)
Embedded Linux and kernel engineering
https://bootlin.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/igt-dev/attachments/20181130/fff4c7cb/attachment-0001.sig>


More information about the igt-dev mailing list