summaryrefslogtreecommitdiff
path: root/src/legacy
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-06-06 16:02:47 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-06-06 16:02:47 +0100
commit536033b4edb40db18210e5272eb8ce9703e5e364 (patch)
treeba106f2f3914144e61ac11c8055449eeb6044279 /src/legacy
parentb2da80c1d1058dca5d3d85693918e53d9fa61dd3 (diff)
legacy/i810/dri: Check for malloc failure for BusIdString
Reported-by: Zdenek Kabelac <zkabelac@redhat.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/legacy')
-rw-r--r--src/legacy/i810/i810_dri.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/legacy/i810/i810_dri.c b/src/legacy/i810/i810_dri.c
index 24632d4f..ba11245b 100644
--- a/src/legacy/i810/i810_dri.c
+++ b/src/legacy/i810/i810_dri.c
@@ -240,10 +240,16 @@ I810DRIScreenInit(ScreenPtr pScreen)
pDRIInfo->busIdString = DRICreatePCIBusID(pI810->PciInfo);
} else {
pDRIInfo->busIdString = malloc(64);
- sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d",
- ((pI810->PciInfo->domain << 8) | pI810->PciInfo->bus),
- pI810->PciInfo->dev, pI810->PciInfo->func
- );
+ if (pDRIInfo->busIdString)
+ sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d",
+ ((pI810->PciInfo->domain << 8) | pI810->PciInfo->bus),
+ pI810->PciInfo->dev, pI810->PciInfo->func
+ );
+ }
+ if (!pDRIInfo->busIdString) {
+ DRIDestroyInfoRec(pI810->pDRIInfo);
+ pI810->pDRIInfo = NULL;
+ return FALSE;
}
pDRIInfo->ddxDriverMajorVersion = I810_MAJOR_VERSION;
pDRIInfo->ddxDriverMinorVersion = I810_MINOR_VERSION;