[Mesa-dev] [PATCH 2/2] st/xorg: add sanity checks after malloc
Emil Velikov
emil.l.velikov at gmail.com
Sat Sep 21 10:03:49 PDT 2013
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
src/gallium/state_trackers/xorg/xorg_driver.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c
index 9d7713c..49e726b 100644
--- a/src/gallium/state_trackers/xorg/xorg_driver.c
+++ b/src/gallium/state_trackers/xorg/xorg_driver.c
@@ -125,6 +125,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);
@@ -277,6 +280,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
--
1.8.4
More information about the mesa-dev
mailing list