aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/common
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xfree86/common')
-rw-r--r--xorg-server/hw/xfree86/common/xf86Config.c32
-rw-r--r--xorg-server/hw/xfree86/common/xf86Helper.c1
-rw-r--r--xorg-server/hw/xfree86/common/xf86Init.c4
3 files changed, 27 insertions, 10 deletions
diff --git a/xorg-server/hw/xfree86/common/xf86Config.c b/xorg-server/hw/xfree86/common/xf86Config.c
index bd90e6ca3..4047350c4 100644
--- a/xorg-server/hw/xfree86/common/xf86Config.c
+++ b/xorg-server/hw/xfree86/common/xf86Config.c
@@ -309,7 +309,7 @@ xf86ModulelistFromConfig(pointer **optlist)
}
if (found == FALSE) {
XF86LoadPtr ptr = (XF86LoadPtr)xf86configptr->conf_modules;
- ptr = xf86addNewLoadDirective(ptr, ModuleDefaults[i].name, XF86_LOAD_MODULE, ModuleDefaults[i].load_opt);
+ xf86addNewLoadDirective(ptr, ModuleDefaults[i].name, XF86_LOAD_MODULE, ModuleDefaults[i].load_opt);
xf86Msg(X_INFO, "\"%s\" will be loaded by default.\n", ModuleDefaults[i].name);
}
}
@@ -318,7 +318,7 @@ xf86ModulelistFromConfig(pointer **optlist)
for (i=0 ; ModuleDefaults[i].name != NULL ; i++) {
if (ModuleDefaults[i].toLoad == TRUE) {
XF86LoadPtr ptr = (XF86LoadPtr)xf86configptr->conf_modules;
- ptr = xf86addNewLoadDirective(ptr, ModuleDefaults[i].name, XF86_LOAD_MODULE, ModuleDefaults[i].load_opt);
+ xf86addNewLoadDirective(ptr, ModuleDefaults[i].name, XF86_LOAD_MODULE, ModuleDefaults[i].load_opt);
}
}
}
@@ -1459,8 +1459,9 @@ configInputDevices(XF86ConfLayoutPtr layout, serverLayoutPtr servlayoutp)
while (irp) {
indp[count] = xf86AllocateInput();
if (!configInput(indp[count], irp->iref_inputdev, X_CONFIG)) {
- while(count--)
+ do {
free(indp[count]);
+ } while(count--);
free(indp);
return FALSE;
}
@@ -1485,7 +1486,7 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
{
XF86ConfAdjacencyPtr adjp;
XF86ConfInactivePtr idp;
- int count = 0;
+ int saved_count, count = 0;
int scrnum;
XF86ConfLayoutPtr l;
MessageType from;
@@ -1553,6 +1554,9 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
scrnum = adjp->adj_scrnum;
if (!configScreen(slp[count].screen, adjp->adj_screen, scrnum,
X_CONFIG)) {
+ do {
+ free(slp[count].screen);
+ } while(count--);
free(slp);
return FALSE;
}
@@ -1641,6 +1645,10 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
}
}
+ if (!count)
+ saved_count = 1;
+ else
+ saved_count = count;
/*
* Count the number of inactive devices.
*/
@@ -1657,16 +1665,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 +1681,14 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
from = X_DEFAULT;
return TRUE;
+
+bail:
+ do {
+ free(slp[saved_count].screen);
+ } while(saved_count--);
+ free(slp);
+ free(gdp);
+ return FALSE;
}
/*
diff --git a/xorg-server/hw/xfree86/common/xf86Helper.c b/xorg-server/hw/xfree86/common/xf86Helper.c
index f94b24184..da15b0503 100644
--- a/xorg-server/hw/xfree86/common/xf86Helper.c
+++ b/xorg-server/hw/xfree86/common/xf86Helper.c
@@ -1831,6 +1831,7 @@ xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
xf86SetEntityFuncs(entityIndex,init,enter,leave,private);
+ free(pEnt);
return pScrn;
}
diff --git a/xorg-server/hw/xfree86/common/xf86Init.c b/xorg-server/hw/xfree86/common/xf86Init.c
index e017d9dce..bf72368c4 100644
--- a/xorg-server/hw/xfree86/common/xf86Init.c
+++ b/xorg-server/hw/xfree86/common/xf86Init.c
@@ -1414,8 +1414,10 @@ xf86LoadModules(char **list, pointer *optlist)
name = xf86NormalizeName(list[i]);
/* Skip empty names */
- if (name == NULL || *name == '\0')
+ if (name == NULL || *name == '\0') {
+ free(name);
continue;
+ }
/* Replace obsolete keyboard driver with kbd */
if (!xf86NameCmp(name, "keyboard")) {