[PATCH 10/11] xfree86: fix memory leak in configLayout

Nicolas PENINGUY nico at lostgeeks.org
Fri Mar 25 17:00:27 PDT 2011


On Fri, 2011-03-25 at 20:41 +0200, Tiago Vignatti wrote:
> diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
> index 4b897a1..82754fc 100644
> --- a/hw/xfree86/common/xf86Config.c
> +++ b/hw/xfree86/common/xf86Config.c
> @@ -1659,6 +1659,7 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
>      while (idp) {
>  	if (!configDevice(&gdp[count], idp->inactive_device, FALSE)) {
>  	    free(gdp);
> +            free(slp);
>  	    return FALSE;
>  	}
>          count++;

I think slp[0..count-1].screen should also be freed.


Also, there is a potential leak in the condition just below :

if (!configInputDevices(conf_layout, servlayoutp))
    return FALSE;



And at line 1554 in the loop

	if (!configScreen(slp[count].screen, adjp->adj_screen, scrnum,
			  X_CONFIG)) {
	    free(slp);
	    return FALSE;
	}

(slp[0..count].screen not freed)

Nicolas




More information about the xorg-devel mailing list