summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJordan Crouse <jordan.crouse@amd.com>2007-01-10 14:23:02 -0700
committerJordan Crouse <jordan.crouse@amd.com>2007-01-10 14:24:06 -0700
commitacc4421ac55d021ef917967ecd09b650e8dd9699 (patch)
treed9a4431495fa042194cadbbf4bba2895db276398 /src
parent888dab329bb66c8e4317d0b6a9736fa70c9686a6 (diff)
Fix a segfault when no valid modes are found
Also - be smart about allocating memory in the RandR part.
Diffstat (limited to 'src')
-rw-r--r--src/amd_gx_driver.c11
-rw-r--r--src/amd_gx_randr.c2
2 files changed, 4 insertions, 9 deletions
diff --git a/src/amd_gx_driver.c b/src/amd_gx_driver.c
index 7eac3a3..7e49ad7 100644
--- a/src/amd_gx_driver.c
+++ b/src/amd_gx_driver.c
@@ -469,7 +469,7 @@ GXCheckVGA(ScrnInfoPtr pScrni) {
return ret ? FALSE : TRUE;
}
-
+
static Bool
GXPreInit(ScrnInfoPtr pScrni, int flags)
{
@@ -736,7 +736,6 @@ GXPreInit(ScrnInfoPtr pScrni, int flags)
if (modecnt <= 0) {
xf86DrvMsg(pScrni->scrnIndex, X_ERROR, "No valid modes were found\n");
- GXFreeRec(pScrni);
return FALSE;
}
@@ -744,7 +743,6 @@ GXPreInit(ScrnInfoPtr pScrni, int flags)
if (pScrni->modes == NULL) {
xf86DrvMsg(pScrni->scrnIndex, X_ERROR, "No valid modes were found\n");
- GXFreeRec(pScrni);
return FALSE;
}
@@ -757,7 +755,6 @@ GXPreInit(ScrnInfoPtr pScrni, int flags)
/* Load the modules we'll need */
if (xf86LoadSubModule(pScrni, "fb") == NULL) {
- GXFreeRec(pScrni);
return FALSE;
}
@@ -769,7 +766,6 @@ GXPreInit(ScrnInfoPtr pScrni, int flags)
&amdExaSymbols[0] : &amdXaaSymbols[0];
if (!xf86LoadSubModule(pScrni, module)) {
- GXFreeRec(pScrni);
return FALSE;
}
@@ -778,7 +774,6 @@ GXPreInit(ScrnInfoPtr pScrni, int flags)
if (pGeode->tryHWCursor == TRUE) {
if (!xf86LoadSubModule(pScrni, "ramdac")) {
- GXFreeRec(pScrni);
return FALSE;
}
@@ -788,7 +783,6 @@ GXPreInit(ScrnInfoPtr pScrni, int flags)
if (xf86RegisterResources(pGeode->pEnt->index, NULL, ResExclusive)) {
xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
"Couldn't register the resources.\n");
- GXFreeRec(pScrni);
return FALSE;
}
@@ -1545,7 +1539,8 @@ GXFreeScreen(int scrnIndex, int flags)
{
GeodeRec *pGeode = GEODEPTR(xf86Screens[scrnIndex]);
- /* XXX FIXME - Something segfaults here when no good modes are found */
+ if (pGeode == NULL)
+ return;
if (pGeode->useVGA) {
if (xf86LoaderCheckSymbol("vgaHWFreeHWRec"))
diff --git a/src/amd_gx_randr.c b/src/amd_gx_randr.c
index bdda3d6..a4fa743 100644
--- a/src/amd_gx_randr.c
+++ b/src/amd_gx_randr.c
@@ -303,7 +303,7 @@ GXRandRInit(ScreenPtr pScreen, int rotation)
GXRandRGeneration = serverGeneration;
}
- pRandr = xalloc(sizeof(XF86RandRInfoRec));
+ pRandr = xcalloc(sizeof(XF86RandRInfoRec), 1);
if (pRandr == NULL)
return FALSE;