aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/common/xf86AutoConfig.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xfree86/common/xf86AutoConfig.c')
-rw-r--r--xorg-server/hw/xfree86/common/xf86AutoConfig.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/xorg-server/hw/xfree86/common/xf86AutoConfig.c b/xorg-server/hw/xfree86/common/xf86AutoConfig.c
index a00340191..14b266d38 100644
--- a/xorg-server/hw/xfree86/common/xf86AutoConfig.c
+++ b/xorg-server/hw/xfree86/common/xf86AutoConfig.c
@@ -282,21 +282,31 @@ listPossibleVideoDrivers(char *matches[], int nmatches)
static Bool
copyScreen(confScreenPtr oscreen, GDevPtr odev, int i, char *driver)
{
+ confScreenPtr nscreen;
GDevPtr cptr = NULL;
- xf86ConfigLayout.screens[i].screen = xnfcalloc(1, sizeof(confScreenRec));
- if(!xf86ConfigLayout.screens[i].screen)
+ nscreen = malloc(sizeof(confScreenRec));
+ if (!nscreen)
return FALSE;
- memcpy(xf86ConfigLayout.screens[i].screen, oscreen, sizeof(confScreenRec));
+ memcpy(nscreen, oscreen, sizeof(confScreenRec));
- cptr = calloc(1, sizeof(GDevRec));
- if (!cptr)
+ cptr = malloc(sizeof(GDevRec));
+ if (!cptr) {
+ free(nscreen);
return FALSE;
+ }
memcpy(cptr, odev, sizeof(GDevRec));
cptr->identifier = Xprintf("Autoconfigured Video Device %s", driver);
+ if (!cptr->identifier) {
+ free(cptr);
+ free(nscreen);
+ return FALSE;
+ }
cptr->driver = driver;
+ xf86ConfigLayout.screens[i].screen = nscreen;
+
/* now associate the new driver entry with the new screen entry */
xf86ConfigLayout.screens[i].screen->device = cptr;
cptr->myScreenSection = xf86ConfigLayout.screens[i].screen;