On 21/02/17 03:55 AM, 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 <[email protected]>
> ---
>  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;
> +       }
>  
> -        /* add to MonPtr */
> -        if (Monitor->Modes) {
> -            Monitor->Last->next = Modes;
> -            Modes->prev = Monitor->Last;
> -            Monitor->Last = Mode;
> -        }
> -        else {
> -            Monitor->Modes = Modes;
> -            Monitor->Last = Mode;
> -        }
>      }

This doesn't make sense to me I'm afraid. The intention of the existing
code is to append all modes in the Modes list to the Monitor->Modes
list. You're changing it to just delete all modes in the Modes list instead.


I'm not sure how this function could be responsible for the memory leaks
you're seeing. Can you provide valgrind output about those leaks?


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to