Signed-off-by: Tiago Vignatti <[email protected]>
---
 hw/xfree86/common/xf86Config.c |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 4b897a1..5fd5eb8 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -1553,6 +1553,8 @@ configLayout(serverLayoutPtr servlayoutp, 
XF86ConfLayoutPtr conf_layout,
            scrnum = adjp->adj_scrnum;
        if (!configScreen(slp[count].screen, adjp->adj_screen, scrnum,
                          X_CONFIG)) {
+           while(count--)
+               free(slp[count].screen);
            free(slp);
            return FALSE;
        }
@@ -1657,16 +1659,14 @@ configLayout(serverLayoutPtr servlayoutp, 
XF86ConfLayoutPtr conf_layout,
     idp = conf_layout->lay_inactive_lst;
     count = 0;
     while (idp) {
-       if (!configDevice(&gdp[count], idp->inactive_device, FALSE)) {
-           free(gdp);
-           return FALSE;
-       }
+       if (!configDevice(&gdp[count], idp->inactive_device, FALSE))
+           goto bail;
         count++;
         idp = (XF86ConfInactivePtr)idp->list.next;
     }
 
     if (!configInputDevices(conf_layout, servlayoutp))
-       return FALSE;
+       goto bail;
 
     servlayoutp->id = conf_layout->lay_identifier;
     servlayoutp->screens = slp;
@@ -1675,6 +1675,14 @@ configLayout(serverLayoutPtr servlayoutp, 
XF86ConfLayoutPtr conf_layout,
     from = X_DEFAULT;
 
     return TRUE;
+
+bail:
+    while(count--)
+       free(slp[count].screen);
+    free(slp);
+    free(gdp);
+
+    return FALSE;
 }
 
 /*
-- 
1.7.0.4

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to