Michel Dänzer <[email protected]> writes: > From: Leo Liu <[email protected]> > > same monitor modes added causing memory leak > when looping `xrandr --prop'. > > Signed-off-by: Leo Liu <[email protected]> > Signed-off-by: Michel Dänzer <[email protected]> > --- > > More than two years later... Can somebody pick this up? > > hw/xfree86/modes/xf86EdidModes.c | 22 ++++++++++++++++++++++ > 1 file changed, 22 insertions(+) > > diff --git a/hw/xfree86/modes/xf86EdidModes.c > b/hw/xfree86/modes/xf86EdidModes.c > index 4ee862d..261780b 100644 > --- a/hw/xfree86/modes/xf86EdidModes.c > +++ b/hw/xfree86/modes/xf86EdidModes.c > @@ -1143,6 +1143,27 @@ handle_detailed_monset(struct > detailed_monitor_section *det_mon, void *data) > } > } > +static void > +xf86PruneDuplicateMonitorModes(MonPtr Monitor) > +{ > + DisplayModePtr master, clone, next; > + > + for (master = Monitor->Modes; > + master && master != Monitor->Last; > + master = master->next) { > + for (clone = master->next; > + clone && clone != Monitor->Modes; > + clone = next) { > + next = clone->next; > + if (xf86ModesEqual (master, clone)) { > + if (Monitor->Last == clone) > + Monitor->Last = clone->prev; > + xf86DeleteMode (&Monitor->Modes, clone); > + } > + } > + } > +} > + > /* > * Fill out MonPtr with xf86MonPtr information. > */ > @@ -1204,5 +1225,6 @@ xf86EdidMonitorSet(int scrnIndex, MonPtr Monitor, > xf86MonPtr DDC) > Monitor->Modes = Modes; > Monitor->Last = Mode; > } > + xf86PruneDuplicateMonitorModes(Monitor); > } > }
It looks like xf86EdidMonitorSet() is just appending the new DDC modes to the monitor. If you switch monitors, I think you get the DDC modes From both. Shouldn't we just be deleting the old M_T_DRIVER modes right before appending?
signature.asc
Description: PGP signature
_______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
