summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEmil Velikov <[email protected]>2013-09-21 17:53:43 +0100
committerEmil Velikov <[email protected]>2013-10-29 21:04:37 +0000
commit2b7ffde8bd0d11258d0e71e01ec226022d51059a (patch)
tree83202404dde0dac83309eca64c10ec97a769f6c4 /src
parent5c398e243c9b9f187bbfeb7933b673b034517dc0 (diff)
st/xorg: add sanity checks after malloc
Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/state_trackers/xorg/xorg_driver.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c
index dd243bccbb9..097c3549ae8 100644
--- a/src/gallium/state_trackers/xorg/xorg_driver.c
+++ b/src/gallium/state_trackers/xorg/xorg_driver.c
@@ -124,6 +124,9 @@ Bool
xorg_tracker_have_modesetting(ScrnInfoPtr pScrn, struct pci_device *device)
{
char *BusID = malloc(64);
+
+ if (!BusID)
+ return FALSE;
sprintf(BusID, "pci:%04x:%02x:%02x.%d",
device->domain, device->bus,
device->dev, device->func);
@@ -276,6 +279,9 @@ drv_init_drm(ScrnInfoPtr pScrn)
char *BusID;
BusID = malloc(64);
+ if (!BusID)
+ return FALSE;
+
sprintf(BusID, "PCI:%d:%d:%d",
((ms->PciInfo->domain << 8) | ms->PciInfo->bus),
ms->PciInfo->dev, ms->PciInfo->func