[xserver] xfree86: fix Xorg memory leak when run xrandr
Peter Hutterer
peter.hutterer at who-t.net
Tue Feb 21 01:45:25 UTC 2017
On Mon, Feb 20, 2017 at 12:55:49PM -0600, Xiaogang Chen wrote:
> xf86DDCGetModes generates some DisplayMods that are not used and not released after.
> Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=99521
>
> Signed-off-by: Xiaogang Chen <Xiaogang.Chen at amd.com>
> ---
> hw/xfree86/modes/xf86EdidModes.c | 17 +++++------------
> 1 file changed, 5 insertions(+), 12 deletions(-)
>
> diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
> index f0e1e97..915b291 100644
> --- a/hw/xfree86/modes/xf86EdidModes.c
> +++ b/hw/xfree86/modes/xf86EdidModes.c
> @@ -1201,18 +1201,11 @@ xf86EdidMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC)
> /* look for last Mode */
> Mode = Modes;
>
> - while (Mode->next)
> - Mode = Mode->next;
> + /*release these video modes that are not used after*/
> + while (Mode) {
> + xf86DeleteMode(&Modes, Mode);
> + Mode = Modes;
> + }
this bit seems correct
>
> - /* add to MonPtr */
> - if (Monitor->Modes) {
> - Monitor->Last->next = Modes;
> - Modes->prev = Monitor->Last;
> - Monitor->Last = Mode;
> - }
> - else {
> - Monitor->Modes = Modes;
> - Monitor->Last = Mode;
> - }
but why are you removing this bit? If that's intended, please expand your
commit message because right now it looks like these are two separate
changes.
Cheers,
Peter
More information about the xorg-devel
mailing list